nginx http请求强转https 无www强转www服务 过百度https认证
生活随笔
收集整理的这篇文章主要介绍了
nginx http请求强转https 无www强转www服务 过百度https认证
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
文章目录
- 1 介绍
- 2 nginx.conf 配置
- 2.1 http 转https
- 2.2 https无www强转www
- 3 过百度https认证
1 介绍
为了让网站个安全,我们通常会安装https证书,但是通常https部署后,https请求仍能访问,所以接下来我们要试下http强转https
2 nginx.conf 配置
2.1 http 转https
http://www.920z.net 转 https://www.920z.net
这里重点利用 return 301
然后443端口的https监听配置好,即可完成强制转换。
2.2 https无www强转www
https://lgch.xyz/转https://www.lgch.xyz
# https没有www跳转www server {listen 443;server_name lgch.xyz;ssl_certificate cert.pem;ssl_certificate_key cert.key;return 301 https://www.lgch.xyz$request_uri; }3 过百度https认证
rewrite ^/(.*) https://www.lgch.xyz? permanent;注意, 域名后面是?不是 $1,否则也会不通过
有勇气的牛排官网:www.920z.net(可兼职接单)
总结
以上是生活随笔为你收集整理的nginx http请求强转https 无www强转www服务 过百度https认证的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: openssl passwd之opens
- 下一篇: java读取json数据并解析输出对象