Hello.
I have been trying to setup access via a domain to Nextcloud and I have hit a brick wall with my googlefoo and the wonderfull support forums here.
I run a RP VM with just NGINX on it which redirects traffic to services on other VM’s.
I can access NextCloud localy by going to the IP for the server its hosted on, and the NGINX on that server deals with the traffic with no issues.
However, when I try to forward traffic from my internet facing RP to the NextCloud VM it refuses to work.
Internet Domain → 10.10.10.50 NGINX → 10.10.10.130 NGINX & NextCloud
When I go to 10.10.10.130 I get Nextcloud
When I go to nextcloud.MYDOMAIN.COM I get “Welcome to nginx!” intro page
Config on 10.10.10.130 NGINX & NextCloud
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html/;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
}
# A long browser cache lifetime can speed up repeat visits to your page
location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
# disable access to hidden files
location ~ /\.ht {
access_log off;
log_not_found off;
deny all;
}
}
Config on internet facing RP (Which I want to pass the inbound traffic to the NGINX instance above)
server_name nextcloud.MYDOMAIN.COM;
location / {
proxy_pass http://10.10.10.130/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;
}
access_log /var/log/nginx/nextcloud.nginx.log;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/nextcloud.MYDOMAIN.COM/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/nextcloud.MYDOMAIN.COM/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = nextcloud.MYDOMAIN.COM) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name nextcloud.MYDOMAIN.COM;
return 404; # managed by Certbot
}
For clarity, this 2nd NGINX block works for many other services, but they don’t point to other servers running NGINX, just a port number on the vm.
Any assistance anyone could offer would be most appreciated.