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
on 2009-11-05 05:05
on 2009-11-05 05:51
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@gmail.com>:
on 2012-11-21 05:39
On 11/20/12 15:31, Gregory Edigarov wrote: >> >> try_files /subdoms/$subdom @fallback; >> > , - . > fallback. > /subdoms/$subdom - , ? try_file : root /subdoms/$subdom; ... try_file $uri $uri/ @fallback; -- Anton Yuzhaninov
on 2012-11-21 05:49
On 11/20/2012 01:35 PM, Anton Yuzhaninov wrote: > > root /subdoms/$subdom; > ... > try_file $uri $uri/ @fallback; > - . $subdom . ????
on 2012-11-21 05:51
On 11/20/2012 01:46 PM, Gregory Edigarov wrote: >> try_file : >> >> root /subdoms/$subdom; >> ... >> try_file $uri $uri/ @fallback; >> > - . $subdom . ???? /subdoms/$subdom - 100%
on 2012-11-21 07:47
On Tue, Nov 20, 2012 at 01:48:59PM +0200, Gregory Edigarov wrote: > >> > >> try_file : > >> > >> root /subdoms/$subdom; > >> ... > >> try_file $uri $uri/ @fallback; > >> > > - . $subdom . ???? > /subdoms/$subdom - 100% root /subdoms/$subdom /subdoms/$subdom . ? "try_files /subdoms/$subdom" , , .. try_files root, , /. , : server { server_name ~^(.*).example.com$; location / { root /tmp/foo/subdoms/$1; try_files $uri $uri/ =404; } $ grep ^ /tmp/foo/subdoms/test*/* /tmp/foo/subdoms/test1/foo:foo /tmp/foo/subdoms/test1/index.html:this is test1 /tmp/foo/subdoms/test2/index.html:this is test2 $ curl http://test1.example.com:8000/ this is test1 $ curl http://test2.example.com:8000/ this is test2 $ curl http://test1.example.com:8000/foo foo ( , .)
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.