server_name

M
  • 5 Nov '09
I use this:

server {
  server_name _;
  server_name_in_redirect off;
  fastcgi_param  SERVER_NAME        $server_name;
}

but when I inspect $_SERVER["SERVER_NAME"] I get this "_", but I would
like to get the domain name, so I change to this:

fastcgi_param ?SERVER_NAME ? ? ? ?$host;

But, is this the right thing to do?

Marcos Neves
+55 44 9918-8488
С
  • 5 Nov '09
Hi

try use $_SERVER["HTTP_HOST"] for host, and use "server_name  _" for
$_SERVER["SERVER_NAME"].

I think it's more right way for your case

2009/11/5 Marcos Neves <marcos.neves at gmail.com>:
> I use this:
>
> server {
> ?server_name _;
> ?server_name_in_redirect off;
> ?fastcgi_param ?SERVER_NAME ? ? ? ?$server_name;
> }
>
> but when I inspect $_SERVER["SERVER_NAME"] I get this "_", but I would
> like to get the domain name, so I change to this:
>
> fastcgi_param ?SERVER_NAME ? ? ? ?$host;
>
> But, is this the right thing to do?
>
> Marcos Neves
> +55 44 9918-8488
>
>

-- 
--
best regards, Sokolov Evgeniy