服务器环境:
1,nginx已安装
2,服务器已配置SSL证书(https一般都是443端口,http一般都是80端口)
3,可通过https://xxx.com(或http://xxx.com:443/xxx)访问成功
要解决的问题
1,由于通过访问http会在访问栏上显示不安全,且不友好
2,故需配置:当访问http服务时,需强制访问https
解决步骤
1,修改默认nginx配置文件:nginx.conf(若是默认安装,一般在/etc/nginx/nginx.conf)
server {
listen 80;
server_name localhost;
return 301 https:域名.com$request_uri;
。。。
}
2,重新启动nginx:
./nginx -s reload //根据自己的目录运行
注意
这只是其中的一种解决办法