首先进入到服务器内,使用
vi /usr/local/nginx/conf/vhost/mrtzone.top.conf
进入到网站配置文件内,mrtzone.top.conf是我网站的配置文件,这里可替换为你的网站配置文件.
然后在下图框选位置添加这段文字:
return 301 https://www.siyinroom.top$request_uri;
红色部分替换为你的网址。
最后重启nginx使配置文件生效。
service nginx restart
/etc/init.d/nginx reload
未经允许不得转载:Mr.T的世界 » #运维#nginx下配置HTTP完全301重定向到HTTPS