Answer the question
In order to leave comments, you need to log in
How to correctly direct nginx to 2 servers?
there are 2 nextcloud servers,
my config is for the first one
server {
listen 80;
server_name my_domain.com.ua www.my_domain.com.ua;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://192.168.1.7/;
client_max_body_size 0;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/my_domain.com.ua/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/my_domain.com.ua/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 = www.my_domain.com.ua) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = my_domain.com.ua) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name my_domain.com.ua www.my_domain.com.ua;
listen 80;
return 404; # managed by Certbot
}
Answer the question
In order to leave comments, you need to log in
Rewrite your spaghetti with weird conditions into normal independent blocks that have unique accepted domain names. Optional - expand the ports too.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question