Hi I'm trying to get the following to work!
I'm basically trying to allow the following URLs to be passed to the proxy_pass directive by either of these two URLS:
http://example.com/admin/1 or http://example.com/admin/2/
I have the following config:
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;
}
}
At the moment, an error is thrown:
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
You should use /admin/1/
in your inner location block as the inner URLs are not relative to the outer URLs. You can see that this is the issue based on the following snippet from the error message you included...
location "1/" is outside location "/admin/"