Hi there,
I am just trying to get into nextcloud, which so far is working quite well.
Although there are some (so far only “cosmetic”) things I can’t fix on my own. During installation and setup I followed the official documentation. My machine is running Ubuntu 16.04. LTS with nginx as webserver. I am running some other websites on my server, which are for internal network (LAN) use only. Each of them are in seperate subdirectories, whereas nextcloud too is sitting under /nextcloud/ on my nginx root. All my other websites use the default configuration from nginx, so for nextcloud I just created a new config under sites-available and then linked it to sites-enabled.
So what I would now expect is that when I try to go to nextcloud I just type [server-ip]/nextcloud/ (with normal http) and then being redirected to https://[server-ip]/nextcloud/. But this doesn’t work, I’m just getting a 404 error. Although when I manually enter https://[server-ip]/nextcloud/ I can enter nextcloud, although the URL is being rewritten to https://[server-ip]/apps/files, without the expected /nextcloud/ ??
Is there a way to tell nginx (or nextcloud) to really use the correct subdirectory? As far as I know these informations should be stored in a .htacces file, which I can’t find though.
Further I already opened the 443 port on my router and from outside (tested it with my mobile) I can connect to nextcloud. I guess a redirect won’t work here unless I would open port 80 too?
My configurations of nginx/php still fit the ones from the official documentation, with the only difference being the separate file for the nginx-config in /sites-enabled/.
Hopefully you guys understand my problem and maybe even can help me.
Well, for starters, the reason it’s not https://yourdomain.com/nextcloud is because you have the root of your webserver in the root of the nextcloud folder. If you wanted it to be yourdomain.com/nextcloud you would need to change root /var/www/html/nextcloud; to root /var/www/html Then there would be a nextcloud folder in the root (/var/www/html) folder on your webserver.
Also, you posted your http config, what about your https config? there should be a server { } directive for each, each with their own root folder.
And you are correct, a redirect from http to https will require both 80 (http) and 443 (https) to be open. The browser has to be able to request the http page in order for nginx to redirect it to https.
I also gave it some additional thought: in my opinion I would need two configurations, one for “external” and for “internal” use? Because for external access it is actually quite nice that you only have to know the domain and not the exact path on the server. Only for access from within the local network I’d like to access nextcloud with /nextcloud/. And the redirect therefore too is only needed for the internal access.