

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
7 messages in ru.sysoev.nginxConditionals in fastcgi config| From | Sent On | Attachments |
|---|---|---|
| Andrew Deason | Oct 17, 2007 1:00 pm | |
| Roxis | Oct 17, 2007 2:18 pm | |
| Andrew Deason | Oct 17, 2007 2:49 pm | |
| Maxim Dounin | Oct 18, 2007 1:49 am | |
| Igor Clark | Oct 30, 2007 9:04 am | |
| Maxim Dounin | Oct 30, 2007 9:50 am | |
| Igor Clark | Oct 30, 2007 11:14 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Conditionals in fastcgi config | Actions... |
|---|---|---|
| From: | Igor Clark (igor...@public.gmane.org) | |
| Date: | Oct 30, 2007 9:04:22 am | |
| List: | ru.sysoev.nginx | |
Hi Igor and nginx people,
We use nginx as a front end on various development machines in our studio to route to installations of Apache 1, Apache 2, PHP/FCGI, and Ruby/Mongrel on each machine, as appropriate depending on SERVER_NAME conventions, using our private DNS domain.
We have some circumstances under which we need to grant external access to machines with this setup, and we do this using Apache reverse proxy on the firewall. (Eventually this will be replaced by nginx, but it's got a lot of legacy stuff which will need some time set aside for converting.) Hence http://outside.dns.name/index.php is proxied through to http://inside.dns.name/index.php.
This means that the SERVER_NAME value seen by the web application (PHP script in this case) is inside.dns.name.
We often configure web applications on a per-host basis, so that e.g. database configuration information is kept in a hash keyed by SERVER_NAME values. This means we need to have SERVER_NAME contain the outside.dns.name.
We've achieved this straightforwardly by setting
fastcgi_param SERVER_NAME $http_x_forwarded_host;
which works nicely, but means that all applications responding to different DNS names (not viewed externally via Apache reverse proxy) fail, because they don't have an X-FORWARDED-HOST header, thus fall back to the local machine hostname, which is not in the configuration hash.
We can get round this by creating separate server {} configurations for applications which need to be served behind a remote reverse proxy, but that defeats the object of our generic per-host configuration based on hostnames.
So ideally I'd like to do something like:
fastcgi_param SERVER_NAME $server_name; if ($http_x_forwarded_host) { fastcgi_param SERVER_NAME $http_x_forwarded_host; }
but: firstly "fastcgi_param" is not supported inside "if", and secondly I don't know how or if this "overriding" would work.
What's the best way to do this, please?
Thanks very much Igor
-- Igor Clark // POKE // 10 Redchurch Street // E2 7DD // +44 (0)20 7749 5355 // www.pokelondon.com
-- Get on Board with WWF for a stronger Climate Change Bill http://getonboard.wwf.org.uk/







