Remote Nginx not connecting to NextCloud

  • Hi All!


    I got Letsencrypt installed and nextcloud setup. I have the LetsEncrypt Nginx running in docker on another server and I want it to do reverse proxy to the file server that has nextcloud running on it. I setup the proxy configs with the sample file on the LetsEncrypt container and added the required lines to the nextcloud config.php suggested in the sample proxy. However, when I try to go to my domain name I get refused to connect. I'm sure it's something misconfigured in the reverse proxy that I am not aware of, being new to reverse proxies and nginx.


    Any help would be much appreciated.

  • Just to get a grip of your setup. Your nextcloud is running on the server with ip 192.168.1.4 and is accessible on port 32773? If that is the case your reverse proxy should point to the right adress.

    Are there any errors of the letsencrypt container when you enter docker logs -f letsencrypt (expect JuaJIT)?

  • Yes nextcloud is running at that location.


    There is this


    nginx: [emerg] "server" directive is not allowed here in /config/nginx/proxy-confs/nextcloud.subdomain.conf:15



    I included the /config/nginx/proxy-confs/*.subdomain.conf in the default file in site-confs.


    EDIT: I moved the include into the nginx.conf file and the error is gone, but still getting the connection refused.

  • I included the /config/nginx/proxy-confs/*.subdomain.conf in the default file in site-confs.


    EDIT: I moved the include into the nginx.conf file and the error is gone, but still getting the connection refused.

    You should not have to change anything. The usage of the subdomain.conf files should be active by default. You deleted the .sample at the of the nextcloud.subdomain.conf, right?

    Better delete the config folder and restart the docker. This will reset the files.


    Try this nextcloud.subdomain.conf

  • This is definitely an nginx issue. I forwarded the nextcloud port directly to the file server where the nextcloud container is hosted and got to it from the outside. Something in nginx isn't forwarding the request to the nextcloud container.

  • I figured it out and I feel really stupid. On the letsencrypt docker I didn't passthrough the proper ports so 443 and 80 were getting random port numbers.

    For example:


    33721 => 443

    33722 => 80


    Once I corrected that it worked.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!