Welcome! Log In Create A New Profile

Advanced

Re: setting server name = hostname explicitly

January 21, 2011 07:36AM
On Mon, Jan 17, 2011 at 02:24:42PM -0500, spurcell wrote:

> Hi everyone,
>
> If Igor's reading, I just want to say that NGINX is amazing and we love
> it. Thank you!
>
> Apologies if this has already been answered elsewhere, but I spent a lot
> of time looking and couldn't find a solution: is there any way to
> specify the current hostname as a valid server_name explicitly without
> using a literal? I know this is what you get if you just leave
> server_name unspecified, but then I can't also have it match
> "localhost", without it being the default server.
>
> So I guess my question could be rephrased as: how can I set up a server
> to match requests to "localhost" and whatever the machine's hostname is
> without hard-coding the hostname in the config file or making the server
> the default. (I don't want the server to be the "default" server for
> port 80; I want another server to do that.)
>
> server_name $hostname; doesn't appear to work, and neither does
> server_name ~$hostname; and I'd like to avoid regex processing overhead
> anyway. I guess ideally what I'd like would be:
>
> server_name $hostname localhost;
>
> or something like that. And if neither matched, it would fall through to
> the default server.

Changes with nginx 0.9.4 21 Jan 2011

*) Feature: the "server_name" directive supports the $hostname variable.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Re: setting server name = hostname explicitly

Igor Sysoev January 21, 2011 07:36AM

Re: setting server name = hostname explicitly

spurcell January 25, 2011 11:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 312
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready