October 26, 2009 06:10PM
On Mon, Oct 26, 2009 at 11:00:15PM +0100, Steve wrote:

>
> -------- Original-Nachricht --------
> > Datum: Tue, 27 Oct 2009 00:33:06 +0300
> > Von: Igor Sysoev <is@rambler-co.ru>
> > An: nginx@sysoev.ru
> > Betreff: Re: nginx-0.8.21
>
> > On Mon, Oct 26, 2009 at 08:45:46PM +0100, Steve wrote:
> >
> > >
> > > -------- Original-Nachricht --------
> > > > Datum: Mon, 26 Oct 2009 21:53:59 +0300
> > > > Von: Igor Sysoev <is@rambler-co.ru>
> > > > An: nginx@sysoev.ru
> > > > Betreff: Re: nginx-0.8.21
> > >
> > > > On Mon, Oct 26, 2009 at 07:14:48PM +0100, Steve wrote:
> > > >
> > > > > > > 2009/10/26 16:36:12 [emerg] 31458#0: host not found in
> > > > "default_server"
> > > > > > of the "listen" directive in
> > > > > > /var/www/hosting/vhosts.conf.d/front/2000_domain.tld.conf:5
> > > > > > >
> > > > > > > What host does nginx have issue to find?
> > > > > >
> > > > > > Could you show the 5th line of the 2000_domain.tld.conf ?
> > > > > >
> > > > > 1 server {
> > > > > 2 #====================================================
> > > > > 3 set $vhost "domain.tld";
> > > > > 4 set $vhost_root "/var/www/vu-hosting/$vhost";
> > > > > 5 listen 80 default_server;
> > > > > 6 server_name www.domain.tld .domain.tld;
> > > > > 7 access_log /var/www/vu-hosting/domain.tld/logs/access_log
> > > > combined;
> > > > > 8 error_log /var/www/vu-hosting/domain.tld/logs/error_log;
> > > > > 9 root /var/www/vu-hosting/domain.tld/htdocs;
> > > >
> > > > Are you sure that it is this file ? This error message should be
> > issued
> > > > for this:
> > > >
> > > > listen default_server;
> > > >
> > > I don't have that there. I have the 80 in front of default_server. The
> > funny thing is that now I updated all the servers (backend as well) to
> > 0.8.21 and the error is gone. And Firefox was right about the redirection error:
> > > alekto ~ # HEAD -H "Host:192.168.0.71" http://192.168.0.71/
> > > 301 Moved Permanently
> > > Connection: close
> > > Date: Mon, 26 Oct 2009 19:36:42 GMT
> > > Location: http://192.168.0.71/
> > > Server: nginx
> > > Content-Length: 178
> > > Content-Type: text/html
> > > Client-Date: Mon, 26 Oct 2009 19:36:42 GMT
> > > Client-Peer: 192.168.0.71:80
> > > Client-Response-Num: 1
> > > Client-Warning: Redirect loop detected (max_redirect = 7)
> > >
> > > alekto ~ #
> > >
> > >
> > > Looking again at the config file I detected a stupid error. I had this
> > in place:
> > > 1 server {
> > > 2 #====================================================
> > > 3 set $vhost "domain.tld";
> > > 4 set $vhost_root "/var/www/vu-hosting/$vhost";
> > > 5 listen 80 default_server;
> > > 6 server_name www.domain.tld .domain.tld;
> > > 7 access_log /var/www/vu-hosting/domain.tld/logs/access_log
> > combined;
> > > 8 error_log /var/www/vu-hosting/domain.tld/logs/error_log;
> > > 9 root /var/www/vu-hosting/domain.tld/htdocs;
> > > 10 #============================================
> > > 11 if ($host !~* "^(.*\.)?(domain\.tld)$") {
> > > 12 rewrite ^/(.*)$ http://$host/$1 permanent;
> > > 13 }
> > > 14 #============================================
> > >
> > >
> > > This produces a loop. Stupid me! Checking if $host is not equal to
> > domain.tld and then rewriting the url to $host. Stupid! Stupid. The right config
> > should be:
> > > 1 server {
> > > 2 #====================================================
> > > 3 set $vhost "domain.tld";
> > > 4 set $vhost_root "/var/www/vu-hosting/$vhost";
> > > 5 listen 80 default_server;
> > > 6 server_name www.domain.tld .domain.tld;
> > > 7 access_log /var/www/vu-hosting/domain.tld/logs/access_log
> > combined;
> > > 8 error_log /var/www/vu-hosting/domain.tld/logs/error_log;
> > > 9 root /var/www/vu-hosting/domain.tld/htdocs;
> > > 10 #============================================
> > > 11 if ($host !~* "^(.*\.)?(domain\.tld)$") {
> > > 12 rewrite ^/(.*)$ http://www.$vhost/$1 permanent;
> > > 13 }
> > > 14 #============================================
> >
> > The right config should be
> >
> > server {
> > listen 80 default_server;
> > server_name _; # just nonexistant domain name
> > rewrite ^ http://www.domain.tld$request_uri? permanent;
> > }
> >
> > server {
> > listen 80;
> > server_name .domain.tld;
> > # www.domain.tld is matched by .domain.tld;
> >
> Will that match domain.tld as well?

Yes, .domain.tld matches domain.tld and *.domain.tld.


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

nginx-0.8.21

Igor Sysoev October 26, 2009 10:20AM

RE: nginx-0.8.21

郭振立 October 26, 2009 11:14AM

Re: nginx-0.8.21

Steve October 26, 2009 11:54AM

Re: nginx-0.8.21

Igor Sysoev October 26, 2009 12:06PM

Re: nginx-0.8.21

Steve October 26, 2009 12:46PM

Re: nginx-0.8.21

Igor Sysoev October 26, 2009 12:50PM

Re: nginx-0.8.21

Steve October 26, 2009 01:14PM

Re: nginx-0.8.21

Igor Sysoev October 26, 2009 01:24PM

Re: nginx-0.8.21

Steve October 26, 2009 01:56PM

Re: nginx-0.8.21

Igor Sysoev October 26, 2009 02:04PM

Re: nginx-0.8.21

Steve October 26, 2009 02:20PM

Re: nginx-0.8.21

Igor Sysoev October 26, 2009 02:58PM

Re: nginx-0.8.21

Steve October 26, 2009 03:50PM

Re: nginx-0.8.21

Igor Sysoev October 26, 2009 05:38PM

Re: nginx-0.8.21

mike October 26, 2009 05:46PM

Re: nginx-0.8.21

Igor Sysoev October 26, 2009 05:54PM

Re: nginx-0.8.21

vesperto October 26, 2009 05:56PM

Re: nginx-0.8.21

mike October 26, 2009 06:04PM

Re: nginx-0.8.21

vesperto October 26, 2009 06:08PM

Re: nginx-0.8.21

mike October 26, 2009 06:22PM

Re: nginx-0.8.21

vesperto October 26, 2009 07:02PM

Re: nginx-0.8.21

Steve October 26, 2009 06:04PM

Re: nginx-0.8.21

Igor Sysoev October 26, 2009 06:10PM

Re: nginx-0.8.21

tromby24 October 27, 2009 01:50AM

Re: nginx-0.8.21

anomalizer March 12, 2010 11:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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