我拥有的大多数外部请求都是Https。但我也有4 http。如何配置NGINX配置以便将所有http外部查询替换为Https?
server {
listen 80;
server_name digitalcommerce.ml www.digitalcommerce.ml;
proxy_connect_timeout 600;
proxy_send_timeout 600;
send_timeout 600;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080/;
}
}
server {
listen 443 ssl;
server_name digitalcommerce.ml www.digitalcommerce.ml;
ssl_certificate /etc/letsencrypt/live/digitalcommerce.ml/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/digitalcommerce.ml/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/digitalcommerce.ml/chain.pem;
proxy_connect_timeout 600;
proxy_send_timeout 600;
send_timeout 600;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080/;
}
}