nginx http强制跳转https
1.按照如下格式修改nginx.conf 配置文件,80端口会自动转给443端口,这样就强制使用SSL证书加密了。
访问http的时候会自动跳转到https上面。
server { listen 80; server_name www.域名.com; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name www.域名.com; root /home/www; ssl on; ssl_certificate /etc/nginx/certs/server.crt; ssl_certificate_key /etc/nginx/certs/server.key; }
2.Nginx实现同一端口HTTP跳转HTTPS
error_page 497 https://$host:$server_port$uri$is_args$args;
相关推荐
nginxs 2020-11-14
Guanjs0 2020-11-13
小木兮子 2020-11-11
yserver 2020-11-11
ssihc0 2020-11-11
windle 2020-11-10
HanksWang 2020-11-10
liuchen0 2020-11-10
Freshairx 2020-11-10
ccschan 2020-11-10
liwf 2020-11-10
Guanjs0 2020-11-09
AderStep 2020-11-09
zrtlin 2020-11-09
mqfcu 2020-11-10
windle 2020-10-29