源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

nginx http重定向https配置说明

  • 时间:2020-08-11 14:37 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:nginx http重定向https配置说明
[b]nginx http重定向https配置说明[/b] 现在什么苹果, 谷歌浏览器请求地扯基本都要求使用https了,如何把原来的http协议重定向到https中呢,这里我们可以使用http反向代理软件nginx。 [b]使用[/b] [b]安装[/b]
yum install nginx -y
[b]配置 [/b]
cat /etc/nginx

server {
 listen 80;
 server_name dounine.com www.dounine.com;
 return  301 https://www.dounine.com$request_uri;
}
server {
 listen 443;
 server_name dounine.com dounine.com;
 return  301 https://www.dounine.com$request_uri;
}
server {
 listen 443;
 server_name www.dounine.com;
 ssl on;
 ssl_certificate /etc/nginx/dounine.crt;
 ssl_certificate_key /etc/nginx/dounine.key;

 location / {
 client_max_body_size 20m;
 proxy_pass http://127.0.0.1:8080;
 proxy_set_header Host $host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 }
}

以上配置可将www.dounine.com、dounine.com与https://dounine.com 重定向至https://www.dounine.com地扯中。 [b]注意[/b] 记得将防火墙的80与443端口打开。 感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部