<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
>From my past work with the FastCGI protocol, I believe all the NV pairs
(params) set using the FastCGI protocol are available to PHP in the
_SERVER global. Also, HTTP_HOST is not supposed to be derived by PHP,
as it reflects the client-side "Host:" header (versus SERVER_NAME which
is the Nginx configured host), so the only way to pass it to PHP would
be through the FCGI protocol (since raw headers are not passed).<br>
<br>
You're entirely correct though that SERVER_NAME gets set with whatever
we pass, so we'll have to adjust our stuff for that in the meanwhile. <br>
<br>
Thanks!<br>
<br>
Erik<br>
<br>
mike wrote:
<blockquote
cite="mid:bd9320b30805131624h4cd57c9ep7dd14aec27882244@mail.gmail.com"
type="cite">
<pre wrap="">I don't believe HTTP_HOST is one you set. I think it's determined by PHP
This is what I set (SERVER_NAME in nginx seems to be different than HTTP_HOST)
fastcgi_param SERVER_NAME $http_host;
Then the people's scripts that were using $_SERVER['SERVER_NAME'] work
properly. Typically I try to use $_SERVER['HTTP_HOST'] ...
$http_host is a variable in nginx, but I think HTTP_HOST in PHP is
being set on its own. not via a param you pass. could be a possible
"bug" in PHP to say "if I want to override default PHP behavior for
HTTP_HOST, I should be able to do it"
Could this be resolved with $_SERVER['SERVER_NAME'] in your PHP code?
and/or in combination with changing it to be $http_host in the fastcgi
params?
On 5/13/08, Erik Osterman <a class="moz-txt-link-rfc2396E" href="mailto:e@osterman.com"><e@osterman.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">We've been running Nginx(0.5.33)+FastCGI(php-cgi 5.1.6) on Fedora 6 for 1
week now and very happy with it. Before this, we were using Nginx as
strictly a HTTP load balancer. I have encountered an issue migrating to
FastCGI, which is that HTTP_HOST cannot be set using fastcgi_param. It seems
that no matter what I pass (e.g. foobar.com), Nginx is not honoring it,
passing the real HTTP_HOST of the request instead. The other variables like
SCRIPT_FILENAME and SCRIPT_NAME are getting set properly if I change them.
Is there something I am doing wrong or is this a known issue?
Best,
Erik
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>