您好,我试图让以下工作!
我基本上试图通过这两个URL中的任何一个将以下URL传递给proxy_pass指令:
http://example.com/admin/1或http://example.com/admin/2/
我有以下配置:
location /admin/ {
# Access shellinabox via proxy
location 1/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://example.com;
}
}
目前,引发了错误:
2016/01/17 15:02:19 [emerg] 1#1: location "1/" is outside location "/admin/" in /etc/nginx/conf.d/XXX.conf:37
nginx: [emerg] location "1/" is outside location "/admin/" in /etc/nginx/conf.d/XXX.conf:37
答案 0 :(得分:15)
您应该在内部位置块中使用/admin/1/
,因为内部网址与外部网址无关。根据您收到的错误消息中的以下代码段,您可以看到这是问题...
location "1/" is outside location "/admin/"