nginx location规则替换

server {
        listen       80;
        server_name  www.6dgame.com 6dgame.com;

	location /2013/ {
		proxy_pass http://127.0.0.1:8081/;
	}
        location / {
            proxy_pass http://127.0.0.1:8080/;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

 
对于此种设置方法,

访问:http://54.200.150.182:8081/2013/和http://54.200.150.182/2013/2013是等效的。

也就是说访问http://54.200.150.182/2013/根据nginx配置会自动替换成http://54.200.150.182:8081

猜你喜欢

转载自newday.iteye.com/blog/2026167
今日推荐