Welcome! Log In Create A New Profile

Advanced

Re: Virtual hosting

April 14, 2012 08:06AM
On Sat, Apr 14, 2012 at 01:44:58PM +0200, Дилян Палаузов wrote:
> Hello,
>
> on my server I have several IP-Addresses and for some of them I want to
> use Nginx to server port 80. I want to host several different domains.
> Let's say A.org and B.org to IP-Address 1.1.1.1:80 and C.org to
> IP-Address 1.1.1.2:80, while 1.1.1.3:80 shall not be used by Nginx.
>
> Shall I configure Nginx something like
> server {
> listen 1.1.1.1;
> server_name A.org B.org;
> if ($host ~ "A.org") {root /A; ... break;}
> if ($host ~ "B.org") {root /B;... break;}
> }
> server {
> listen 1.1.1.2;
> server_name C.org;
> }
> or is there a way to configure three different server{}s?
> server { server_name A.org; }
> server { server_name B.org; }
> server { server_name C.org; listen 1.1.1.2; }
>
> In the former form, I cannot use directly "root /A;" in if ().
>
> In the latter form, I cannot use for A.org and B.org listen 1.1.1.1, as
> Nginx says it cannot bind twice IP1.1.1.1 (it can bind to it for A, but
> since the socket is already occupied, it cannot bind for for B.org}.

server { listen 1.1.1.1; server_name A.org; }
server { listen 1.1.1.1; server_name B.org; }
server { listen 1.1.1.2; server_name C.org; }

> Moreover, as the Nginx module documentation is available both trough
> wiki.nginx.org (wiki.nginx.org/HttpCoreModule) and
> http://www.nginx.org/en/docs/, I would like to ask which is the
> reference documentation (and what is the point to have the documentation
> on two different places -- e.g. why isn't the wiki enough).

The right place is http://www.nginx.org/en/docs/
Until this year the only English documentation was in wiki,
but the wiki contains errors and inaccurancies.


--
Igor Sysoev

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

Virtual hosting

Дилян Палаузов April 14, 2012 07:46AM

Re: Virtual hosting

Jonathan Matthews April 14, 2012 08:04AM

Re: Virtual hosting

Igor Sysoev April 14, 2012 08:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 177
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