Hi there I have installed Collaboora on my Ngnix server. Also i have installed it on apache2 and added the configuration file to the apache2.conf
Define EXAMPLE_BASE_PATH "/var/www/html"
AliasMatch "^/demo/media/" "${EXAMPLE_BASE_PATH}/demo/media/endpoints.php"
Alias /collebora "${EXAMPLE_BASE_PATH}/collebora"
<Directory "${EXAMPLE_BASE_PATH}/collebora">
Options Indexes MultiViews
AllowOverride None
<IfModule !mod_access_compat.c>
Require all granted
</IfModule>
<IfModule mod_access_compat.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
this is my coolwsd.xml setting
<storage desc="Backend storage">
<filesystem allow="ture"/>
<wopi allow="false" desc="Allow/deny wopi storage.">
<max_file_size desc="Maximum document size in bytes to load. 0 for unlimited." type="uint">0</max_file_size>
<locking desc="Locking settings">
<refresh default="900" desc="How frequently we should re-acquire a lock with the storage server, in seconds (default 15 mins) or 0 for no refresh" type="int">900</refresh>
</locking>
<alias_groups desc="default mode is 'first' it allows only the first host when groups are not defined. set mode to 'groups' and define group to allow multiple host and its aliases>
<group>
<host desc="hostname to allow or deny." allow="true">https://legai\.tech:443</host>
<alias desc="regex pattern of aliasname">https://\w+\.legai\.tech:443</alias>
</group>
<!-- If you need to use multiple wopi hosts, please change the mode to "groups" and
add the hosts below. If one host is accessible under multiple ip addresses
or names, add them as aliases. -->
<!--<group>
<host desc="hostname to allow or deny." allow="true">scheme://hostname:port</host>
<alias desc="regex pattern of aliasname">scheme://aliasname1:port</alias>
<alias desc="regex pattern of aliasname">scheme://aliasname2:port</alias>
</group>-->
<!-- More "group"s possible here -->
</alias_groups>
</wopi>
<ssl desc="SSL settings">
<as_scheme default="true" desc="When set we exclusively use the WOPI URI's scheme to enable SSL for storage" type="bool">true</as_scheme>
<enable desc="If as_scheme is false or not set, this can be set to force SSL encryption between storage and coolwsd. When empty this defaults to following the ssl.enable setting" >
<cert_file_path desc="Path to the cert file" relative="false"/>
<key_file_path desc="Path to the key file" relative="false"/>
<ca_file_path desc="Path to the ca file. If this is not empty, then SSL verification will be strict, otherwise cert of storage (WOPI-like host) will not be verified." relative="fa>
<cipher_list desc="List of OpenSSL ciphers to accept. If empty the defaults are used. These can be overridden only if absolutely needed."/>
</ssl>
</storage>
this is my load.php javascript function
function loadDocument() {
var wopiSrc = window.location.origin + '/demo/media/contracts/1597118297';
// alert(wopiSrc);
var filename = '1597118297.docx';
var wopiClientUrl = "<?php echo $_WOPI_SRC; ?>";
var wopiClientUrl = "https://demo.legai.tech:8000/browser/96e80a8/cool.html?";
// alert(wopiClientUrl);
if (!wopiClientUrl) {
console.log('error: wopi client url not found');
return;
}
var wopiUrl = wopiClientUrl+'WOPISrc='+wopiSrc;
// alert(wopiUrl);
var formElem = document.getElementById("collabora-submit-form");
if (!formElem) {
console.log('error: submit form not found');
return;
}
formElem.action = wopiUrl;
formElem.submit();
}
loadDocument();
this is my endpoint.php function
function wopiGetFile($documentId) {
$filePath = "/var/www/html/demo/media/1597118297";
if (file_exists($filePath)) {
// Set the appropriate headers for a .docx file
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Disposition: attachment; filename="' . basename($filePath) . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($filePath));
// Clear any previous output
ob_clean();
flush();
// Read the file and output its content.
echo readfile($filePath);
//exit;
} else {
// Handle the error if the file does not exist
header("HTTP/1.1 404 Not Found");
echo "Error: The requested document was not found on the server.";
//exit;
}
// $fileContent = 'Hello Haider and john';
// echo $fileContent;
}