Installing document server on local server, file Permission: Download file failed
benben994 opened this issue · 12 comments
I had currently installed only the Document Server community edition by using docker and which has worked. But after trying installing PHP example on the other server and edited the configuration file, I still can't get it work(having 500 internal error).
After reading documents I realized that "document manager" and "document storage service" are not provided with Document Server but in Community Server. (According to the HOW IT WORK page)
After while I checked the config.php I found out that I only have three variable
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "http://xxx.xxx.xxx.xxx/ConvertService.ashx";
$GLOBALS['DOC_SERV_API_URL'] = "http://1xxx.xxx.xxx.xxx/web-apps/apps/api/documents/api.js";
$GLOBALS['DOC_SERV_PRELOADER_URL'] = "http://xxx.xxx.xxx.xxx/web-apps/apps/api/documents/cache-scripts.html";
but missing the below one, (I added myself)
$GLOBALS['DOC_SERV_STORAGE_URL'] = "http://104.199.181.162/FileUploader.ashx";
The question is how can I start with if I want to implement document manager and document storage service myself, instead of using Nextcloud etc or installing community server?
The second question is that even I have the below variable originally, but I don't have ConvertService.ashx on my Document Server. Is there something I miss? Or where can I get these two .aspx files?
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "http://xxx.xxx.xxx.xxx/ConvertService.ashx"
DocumentServer version:
Operating System:
Debian 9
But after trying installing PHP example on the other server and edited the configuration file, I still can't get it work(having 500 internal error).
Do you get that error when opening a document or PHP example?
but missing the below one, (I added myself)
$GLOBALS['DOC_SERV_STORAGE_URL'] = "http://xxx.xxx.xxx.xxx/FileUploader.ashx";
Please remove it, that string isn't required when working with PHP Example
The question is how can I start with if I want to implement document manager and document storage service myself, instead of using Nextcloud etc or installing community server?
You can start with any of our examples available here
The second question is that even I have the below variable originally, but I don't have ConvertService.ashx on my Document Server.
You have it if you have Document Server installed. Now we should understand what's wrong with your DS instance.
Hi, @ibnpetr Thanks for reply
So first let me explain the details.
I have installed document server with docker on my centos which can show "Document Server is Running". Then I follow the PHP example which you also mentioned, and I have this page below with no error in console.
But whether I click "Upload file" will cause 500 internal error, and "Create Document" will open another page show File not found.
When I followed the example step by step, I also found that the document tell me to fill
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "http://xxx.xxx.xxx.xxx/ConvertService.ashx";
But actually I can't find this file in my server, I don't know maybe it could be the reason.
Btw for the checking accessibility, I had typed "wget" in both server to reach others and it worked.
I'm not sure if there's other way to do it.
<---New progress--->
I followed the document of "Installing all three servers (Community Server, Document Server, Mail Server) integrated", which worked perfectly. But obviously that I only need the online editor and document server part. So back to the same question, why would I have the 500 Internal server error? Did I miss some steps or important files?
Most likely the problem is not in the connection settings to the editors.
The php site probably does not have rights to create a folder and files on the disk. By default, the folder is created in the root of the site with the name of the user's IP address.
Hi @LinneyS,
So you means that it's may mainly caused by the client side?
I had made a little demo script according to the document, but which shows Download files failed.
Therefore I have two questions:
First, where should I place the docx file on document server initially, while I have url:
"http://xxx.xxx.xxx.xxx/test.docx" in my js script?
Second, according to what you mentioned, I had set chown www-data:www-data from /var to /var/www/html/index.html on client side. But the error is still exist, so I'm confused what permission should I change?
Thanks for your reply.
Strange. Should help chown -R www-data:www-data /var/www/html
For http://xxx.xxx.xxx.xxx/test.docx
the file must be in /var/www/html/test.docx
Hi @LinneyS,
Below is the directory structure of my document server, and test-document.docx is the file I try to open.
And the below script is I copied from the api document, and I have changed the documentserver to my server IP.
new DocsAPI.DocEditor("placeholder", {
"document": {
"fileType": "docx",
"key": "Khirz6zTPdfd7",
"title": "Example Document Title.docx",
"url": "http://documentserver/test-document.docx"
},
"documentType": "text"
});
The problem now is that I won't have 500 Internal error, but the loading document will show up Download failed. Do I have the correct path according to the directory?
Btw, is it enough that I type chown www-data:www-data and chmod 755 for every files on server?
I'm now confusing with that I may have server-side or client-side problem.
@benben994, SELinux is blocking httpd from writing/creating dirs
Try this:
chcon -R -t httpd_sys_content_rw_t /var/www/html
Hi @flaminestone,
as installing the document server by docker, the OS is Ubuntu 16.04.
I have noticed that document say the SELinux issue occurred on Centos, and the command you provided cause error below. (Sorry, I'm not familiar with SELinux security...
chcon: can't apply partial context to unlabeled file
Anyway, thanks for your advice, I'll survey more about SELinux tomorrow and see if there's SELinux issue not only on Centos but also on Ubuntu.
Sorry for mistyping the OS, I'm using Debian 9 on GCP and docker's OS is Ubuntu 16.04. So I think there's SELinux issue.Tracing all of the log files, the only error message I could find is in the out.log of converter.
I found this Error in app/onlyoffice/DocumentServer/logs/documentserver/converter
Does anyone has any clue?
Hi all, is there any chance that error is due to proxy?
I have docker on the port 80, and my client's apache2 is on port 8081 on the same server.
I can display the online editor but can not get the file from document server on docker.
I found this in the documentation, maybe I'll just give it a try.
https://helpcenter.onlyoffice.com/server/document/document-server-proxy.aspx
Hi all. I have been thinking about the file permission issue and finally I figured out the solution.
sudo find /var/www/html -type d -exec chmod 775 {} ;
sudo find /var/www/html -type f -exec chmod 664 {} ;
These two commands ensure that script may have the permission to create directory and upload file, moreover, the script will have permission to further deal with the new directory and file.
I only type chown -R www-data:www-data /var/www/html/ in the first place.
I'm not sure these two commands are required or not, but I suggest that you may put in document somewhere, ex: troubleshooting.
Anyway, thanks for the response above.