nginx http重定向https配置说明
2017-04-14 08:49
1036 查看
nginx http重定向https配置说明
现在什么苹果,谷歌浏览器请求地扯基本都要求使用https了,如何把原来的http协议重定向到https中呢,这里我们可以使用http反向代理软件nginx。
使用
安装
yum install nginx -y
配置
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地扯中。
注意
记得将防火墙的80与443端口打开。
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
您可能感兴趣的文章:
相关文章推荐
- 服务器 nginx配置ssl并http重定向到https
- nginx的多域http、https同时访问配置及http重定向https
- nginx 配置http重定向到https
- nginx 配置http跟https跳转时总是提醒重定向过多解决办法
- nginx 配置http请求重定向至https
- nginx配置http和https共存
- Nginx配置同一个域名http与https两种方式都可访问
- nginx将http重定向到https
- nginx服务器http重定向到https的正确写法
- 【T电商 3】Nginx的Http(图片)服务器配置+ftp上传使用说明
- nginx中实现把所有http的请求都重定向到https
- HTTP与HTTPS区别、nginx配置
- Nginx配置https和http可同时访问方法
- 【Ts 3】Nginx的Http(图片)服务器配置+ftp上传使用说明
- Nginx的https配置记录以及http强制跳转到https的方法梳理
- Nginx安装配置SSL证书并强制http跳转到https
- nginx服务器http重定向到https的正确写法
- Lighttpd 启用 HTTPS 并重定向 HTTP 为 HTTPS 访问配置
- Nginx配置http强制跳转到https
- 【环境配置】申请StartSSL免费CA证书,配置Nginx使用https访问,强制http跳转到https