Hi All,
I have created a virtual host where I want to handle unlimited top-level
domains.
Domains are registered elsewhere and I am using “A record” pointing to
my
nginx server’s dedciated IP at respective domains
registrars/name-servers.
I have following in my vhost config file…
server {
listen 80 default;
server_name _ “”;
Everything is working expect some minor issues.
- Logs shows server name as “_”
- Cookies and some scripts where host is supposed to be host in URL,
it
is set to “_”
Its not breaking anything. And everything is working cool.
But is there anyway to have server_name set to "host"name in HTTP
request?
Thanks,
-Rahul
Hello,
You need a custom log format that uses $http_host instead of
$server_name, please see
Module ngx_http_log_module .
You may also want to use ‘server_name_in_redirect off’ to ensure that
server_name is not passed back to clients.
Thanks,
Merlin
Hi Merlin,
Thanks for ur reply.
But can I do something like “set server_name $http_host”?
For some reason that I cannot explain (lack of my knowledge may be) I
need
server_name to reflect http_host value.
Is there any workaround which just works with nginx 0.7.
Thanks,
-Rahul
On Sat, Dec 12, 2009 at 11:23:09PM +0530, Rahul B. wrote:
Hi Merlin,
Thanks for ur reply.
But can I do something like “set server_name $http_host”?
For some reason that I cannot explain (lack of my knowledge may be) I need
server_name to reflect http_host value.
Where do you use this server_name ?
You need a custom log format that uses $http_host instead of
wrote:
listen 80 default;
Its not breaking anything. And everything is working cool.
nginx mailing list
[email protected]
nginx Info Page
nginx mailing list
[email protected]
nginx Info Page
–
Igor S.
http://sysoev.ru/en/
On Sun, Dec 13, 2009 at 01:12:12PM +0530, Rahul B. wrote:
when I set “server_name _”.
Now I removed server_name and set “server_name_in_redirect off”
Now host is being set to maindomain.com even though HOSTs are
site1.com, site2.com and so on.
Basically I’m using wordpress MU with domain mapping.
So any random domain can be served from my server as long as it has
account in MU and proper CNAME record at its DNS end.
Probably, you should say wordpress about SERVER_NAME:
fastcgi_param SERVER_NAME $host;
in fastcgi_params files.
–
Igor S.
http://sysoev.ru/en/
Hi Igor,
Probably, you should say wordpress about SERVER_NAME:
fastcgi_param SERVER_NAME $host;
Practically it didnt work. 
Logically I expected it to work.
I will dig into wordpress to see what is the problem.
Thanks,
-Rahul
Hi Igor,
For some reason that I cannot explain (lack of my knowledge may be) I need
server_name to reflect http_host value.
Where do you use this server_name ?
I am not using “server_name” explicitly anywhere.
Earlier some logs and a cookies my PHP site showing host part as “_”
when I set “server_name _”.
Now I removed server_name and set “server_name_in_redirect off”
Now host is being set to maindomain.com even though HOSTs are
site1.com, site2.com and so on.
Basically I’m using wordpress MU with domain mapping.
So any random domain can be served from my server as long as it has
account in MU and proper CNAME record at its DNS end.
If you leave out server_name completely and have only that one server
definition, that should accomplish what you want.
merlin corey wrote:
Hello,
You need a custom log format that uses $http_host instead of
$server_name, please see
Module ngx_http_log_module .
Or in this case, just leave out the server_name directive entirely.
domains.
Everything is working expect some minor issues.
nginx mailing list
Marcus.
UPDATE:
Probably, you should say wordpress about SERVER_NAME:
fastcgi_param SERVER_NAME $host;
It worked!
I came to resolve issue again and saw it has solved. Last thing I
changed on
last weekend was “fastcgi_param SERVER_NAME $host;” line.
I guess I should have cleared cache at that time!
Thanks all!
Rahul B. | Founder & CEO | rtCamp Solutions Pvt. Ltd.
Mobile: +91-9860501882 | Web: http://rtcamp.com/