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 N.
+55 44 9918-8488
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 N. [email protected]:
On 11/20/12 15:31, Gregory E. wrote:
try_files /subdoms/$subdom @fallback;
, - .
fallback.
/subdoms/$subdom - , ?
try_file :
root /subdoms/$subdom;
…
try_file $uri $uri/ @fallback;
–
Anton Y.
On 11/20/2012 01:35 PM, Anton Y. wrote:
root /subdoms/$subdom;
…
try_file $uri $uri/ @fallback;
On 11/20/2012 01:46 PM, Gregory E. wrote:
try_file :
root /subdoms/$subdom;
…
try_file $uri $uri/ @fallback;
- . $subdom . ???
/subdoms/$subdom - 100%
On Tue, Nov 20, 2012 at 01:48:59PM +0200, Gregory E. 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
( ,
.)