Nginx自动从http跳转到https
#vim nginx.conf
server {
listen 80;
server_name www.test.com;
charset utf-8;
return 301 https://$server_name$request_uri; #添加这行,即可以实现从http跳转到https
access_log logs/wwwuat.yaok.com.log main;
location / {
rewrite ^/(.*)$ //$1 last;
}
location ^~ // {
proxy_pass http://127.0.0.1:8064;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
时间: 2024-10-01 21:43:17