200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > nginx访问http跳转到https上的配置

nginx访问http跳转到https上的配置

时间:2023-10-07 06:48:16

相关推荐

nginx访问http跳转到https上的配置

使用nginx的301永久性重定向, 简洁明了。新建一个server来完成这个动作

配置

# 301重定向, 访问http跳转到httpsserver {listen 80; #80固定server_name 域名;return 301 https://域名$request_uri;}

我的nginx上的zc_travel.conf

# 301重定向, 访问http跳转到httpsserver {listen 80;server_name 域名;return 301 https://域名$request_uri;}# ssl配置server {listen 443 ssl;server_name 域名;root html;index index.html index.htm;ssl_certificate ../cert/.pem;ssl_certificate_key ../cert/.key;ssl_session_timeout 5m;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;ssl_prefer_server_ciphers on;location / {proxy_pass http://localhost:8009;}}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。