I migrate nginx from centos to Ubuntu, this configuration works perfectly on old nginx in centos:
proxy_set_header Host $host:$server_port;
$_SERVER['REMOTE_ADDR'] - REALIP
$_SERVER['SERVER_PORT'] - 443
$_SERVER['HTTP_X_FORWARDED_FOR'] - REALIP
$_SERVER['REQUEST_SCHEME'] https
$_SERVER['HTTP_X_FORWARDED_PROTO'] https
Now I will get connection as 80 port.
set $maintenance off;
listen 443 ssl;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:...
ssl_dhparam /etc/nginx/ssl/dh.pem;
ssl_stapling on;
resolver 8.8.8.8;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1h;
ssl_session_tickets on;
ssl_session_ticket_key /etc/nginx/ssl_tickets.key;
proxy_set_header Host $host;
proxy_set_header X-Host $host;
proxy_set_header X-SSL-Cipher $ssl_cipher;
proxy_set_header X-Forwarded-Proto "https";
proxy_set_header X-SSL-Client-Verify $ssl_client_verify;
proxy_set_header X-SSL-Protocol $ssl_protocol;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-HTTPS "on";
If i change configuration:
#proxy_set_header Host $host;
proxy_set_header X-Host $host;
proxy_set_header Host $host:$server_port;
i cant get ssl connection, but in wp i get url as http://wpdomain.com:443/....
How it can be fixed, to get 443 connection nginx->apache and with normal URL of uploaded files?