说明:现在越来越多的人开始为网站启用ssl证书了,安装了ssl后我们都需要让http强制跳转https,并确定网站唯一性,这里介绍了几种方法。
方法
提示:以军哥的lnmp一键安装包为例,Nginx
配置文件修改地址为/usr/local/nginx/conf/vhost/xx.com.conf
。
方法一:
if ($scheme = http ) {
return 301 https://$host$request_uri;
}
方法二:
server_name moerats.com ;
rewrite ^(.*) https://moerats.com$1 permanent;
方法三:
if ($server_port = 80 ) {
return 301 https://$host$request_uri;
}
方法四:
server_name moerats.com ;
return 301 https://$server_name$request_uri;
最后输入/etc/init.d/nginx restart
重启Nginx即可
未经允许不得转载:嘟嘟 » Nginx环境强制http 301跳转https的方法
最新评论
请问下,python3 tg_username_update.py都会提示下面这个是因为什么啊 Traceback (most recent call last): File "tg_username_update.py", line 21, in <module> cake = emojize(":cake:", use_aliases=True) TypeError: emojize() got an unexpected keyword argument 'use_aliases'
不可以了
# Install [Debian] [bullseye] [amd64] Downloading... grep: (standard input): binary file matches Error! grub.cfg. root@RRR2:~#
博主你好,请问cloudfront 上传收费这个是事实吧,已经找了几个贴子确认了。 那有什么好办法能够避开这个收费呢?如果不能避开感觉还是cloudflare 比较稳。
来看看
第5步添加自定义主机名进去后等txt验证提示custom hostname does not name to this zone
那没事了,我静态博客。谢谢
为什么缓存键和源请求那里不设置缓存?