nginx http重定向https配置说明
nginxhttp重定向https配置说明
现在什么苹果,谷歌浏览器请求地扯基本都要求使用https了,如何把原来的http协议重定向到https中呢,这里我们可以使用http反向代理软件nginx。
使用
安装
yuminstallnginx-y
配置
cat/etc/nginx
server{
listen80;
server_namedounine.comwww.dounine.com;
return301https://www.dounine.com$request_uri;
}
server{
listen443;
server_namedounine.comdounine.com;
return301https://www.dounine.com$request_uri;
}
server{
listen443;
server_namewww.dounine.com;
sslon;
ssl_certificate/etc/nginx/dounine.crt;
ssl_certificate_key/etc/nginx/dounine.key;
location/{
client_max_body_size20m;
proxy_passhttp://127.0.0.1:8080;
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
}
}
以上配置可将www.dounine.com、dounine.com与https://dounine.com重定向至https://www.dounine.com地扯中。
注意
记得将防火墙的80与443端口打开。
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下