I have finally gotten around to setting up a Nginx reverse proxy to handle the multiple websites I host at my house since I only have one external IP address and everything is working, but what I want to know is if there is a way I can simplify the current configuration for one of my sites that is longer than I feel it needs to be. Any input is greatly appreciated.
server {
listen 192.168.1.176:80;
server_name ighfdexplorers.com;
return 301 https://www.$server_name$request_uri;
}
server {
listen 192.168.1.176:443 ssl http2;
server_name ighfdexplorers.com;
return 301 https://www.$server_name$request_uri;
ssl_certificate /etc/nginx/ssl/ighfdexplorers/base/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/ighfdexplorers/base/privkey.pem;
}
server {
listen 192.168.1.176:80;
server_name www.ighfdexplorers.com;
return 301 https://$server_name$request_uri;
}
server {
listen 192.168.1.176:443 ssl http2;
server_name www.ighfdexplorers.com;
set $upstream 192.168.1.179;
ssl_certificate /etc/nginx/ssl/ighfdexplorers/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/ighfdexplorers/privkey.pem;
location / {
proxy_pass_header Authorization;
proxy_pass https://$upstream;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_session_reuse off;
}
}