Created
June 3, 2011 14:12
-
-
Save mattd/1006398 to your computer and use it in GitHub Desktop.
nginx try_files with a proxy_pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
root /var/www/example.com/static; | |
server_name example.com; | |
access_log /var/log/nginx/example.com.access.log; | |
error_log /var/log/nginx/example.com.error.log; | |
try_files /maintenance.html @proxy; | |
location @proxy { | |
proxy_pass http://127.0.0.1:10001; | |
include /etc/nginx/proxy.conf; | |
} | |
} |
Thanks!
👍
Thanks man! In my case both tries will be proxy_pass references... WOAH
brilliant
Thank you!
this is gem.
Thanks!
In the other case:
location /static/ {
error_page 404 = @remote_images;
proxy_pass http://127.0.0.1:8080$request_uri;
}
location @remote_images {
resolver 8.8.8.8;
proxy_set_header Host remote.example.org;
proxy_pass http://remote.example.org;
}
I ended like this:
upstream your-node-name {
server 127.0.0.1:8080;
# server 127.0.0.1:8081;
}
server {
try_files $uri $uri/ @nodeproxy;
location @nodeproxy {
proxy_pass http://your-node-name;
...
}
}
In case i have two locations. How to write try_file ?
brilliant
What about if your server is not on the localhost? I have an issue with it. Is there any way?
What about if your server is not on the localhost? I have an issue with it. Is there any way?
Same problem here. I got error 500 with proxy_pass.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
brilliant