nginx配置记录

http请求转到https

location / {
access_log /usr/local/nginx/logs/access2.log access4;
rewrite ^(.*)$ https://$host$1 permanent; #访问转到https
#当502或504时,将请求转发到负载均衡中正常server中
#proxy_next_upstream http_502 http_504 error timeout invalid_header;
#proxy_pass http://cloudringpy;
#proxy_redirect off;
#proxy_set_header Host $host:80;
#若nginx为最前端时,后端获得X-Real-IP传递的ip即为实际ip,若nginx不是最前端时,实际ip为X-Forwarded-For值。
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

posted @ 2017-09-29 11:19  鸾舞春秋  阅读(131)  评论(0编辑  收藏  举报