Uploading files cause internal server error (Nginx, 2x php blocks)

I have nextcloud running on Ubuntu 16.4 with nginx and php7.

NC is accessed via a https://foo.bar/nextcloud

Nginx config: http://pastebin.com/WhWvmcwL

As you can see I have two location blocks for php. One for nextcloud and one for the other php files in the same webroot.

This setup works in all but one case. When I uload files from the web ui, I get a popup saying “interal server error”, and the file is not uploaded. If I disable the general php block everything works fine (except all other applications on the server :p)

Any suggestions? :frowning:

Could you post the output of the following just after trying to upload a file:
systemctl status nginx

Also, are there any obvious errors in the owncloud.log file in the data folder?

can you upload files from Webdav applications ?

Thanks for quick response! :slight_smile:

There are no errors in the owncloud.log for this event, however I get something in the nginx log: http://pastebin.com/MYFi8K7Z

Webdav (iOS and desktop client) work perfectly.

Also, as requested:

root@pepperkake:~# systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2016-07-23 14:59:31 CEST; 6s ago
Process: 24456 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 24465 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 24459 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 24468 (nginx)
Tasks: 5
Memory: 3.9M
CPU: 91ms
CGroup: /system.slice/nginx.service
├─24468 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
├─24469 nginx: worker process
├─24470 nginx: worker process
├─24471 nginx: worker process
└─24472 nginx: worker process

Jul 23 14:59:31 pepperkake systemd[1]: Starting A high performance web server and a reverse proxy server…
Jul 23 14:59:31 pepperkake systemd[1]: Started A high performance web server and a reverse proxy server.

I am a beginner in GNU/Linux world so I made a mistake that led me to have the same problem as you with my nextcloud configuration. I wasn’t able to upload any file from webui and I haven’t found anything in logs files. Webdav worked perfectly. I haven’t found anything relative to my problem on the internet so I searched a bit by myself, I found a code error in my nginx configuration for nextcloud. I took the conf from the the previous version of owncloud.
Perharps you can check that file in details, I had a problem under a location string somewhere.

Hope that can help you too.

This turned out to be a sever and embarrasing case of me not having RTFM.

All my location blocks lived outside a general “location ~ /nextcloud”. Apparently this worked in all but this one case. The general block is clearly stated in the configuration example I used.

I addedd the block, and now everything works perfectly.

Sorry for wasng your time ;p

Glad you found the solution @Dnet8, and even more glad you came back and shared it with the community! Thank you! :smiley: