nginx基本配置,网站https配置及http强调https
## THE IP INFOMATION OF "web-test.demo.com" ## upstream web-test.demo.com { server 10.100.40.101:32100; } ## THE SERVER INFOMATION OF "web-test.demo.com" ## server { listen 80; server_name web-test.demo.com; rewrite ^(.*)$ https://$host$1 permanent; } server { listen 443 ssl; server_name web-test.demo.com; ssl_certificate service2019.pem; ssl_certificate_key service2019.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES'; ssl_prefer_server_ciphers on; location / { proxy_set_header SSL_CERT $ssl_client_cert; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://web-test.demo.com; client_max_body_size 100m; proxy_connect_timeout 75s; proxy_read_timeout 300s; } if ($request_method !~ ^(GET|HEAD|POST)$ ) { return 501; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; } }