I have a server serving several subdomains; actually proxying'em to
apache2. So I have main nginx vhost file with all server_name's added.
Such server names match the defined ServerName's and ServerAlias'es of
Apache.
Beside, I have one more file to define a default_server catch all block
like follows
server {
listen 80 default_server;
server_name _;
error_log /var/log/nginx/000default-error.log error;
root /var/www/forvo.com/_templates;
error_page 404 /404.html;
location / {
#return 444;
return 404;
}
location = /404.html {
internal;
}
#rewrite .* http://myfaultysubdomain.com permanent;
}
As soon as I enable this file, everything works as expected, however, in
less than one minute (my site is always being visited), all requests
(good subdomains and bad subdomains as well) start to get 503 response.
No log at all seems to change when this happens.
Any clue to what may be happening pleeeeeease ......it's been hours,
during days, trying to figure out what the h@$!! is going on
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221572,221572#msg-221572
_______________________________________________
nginx mailing list
ng...@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
> Hi, getting quite desperate at the moment about this.
>
> I have a server serving several subdomains; actually proxying'em to
> apache2. So I have main nginx vhost file with all server_name's
> added. Such server names match the defined ServerName's and
> ServerAlias'es of Apache. Beside, I have one more file to define a
> default_server catch all block like follows
>
> server {
> listen 80 default_server;
> server_name _;
> error_log /var/log/nginx/000default-error.log error;
> root /var/www/forvo.com/_templates;
> error_page 404 /404.html;
> location / {
> #return 444;
> return 404;
> }
> location = /404.html {
> internal;
> }
> #rewrite .* http://myfaultysubdomain.com permanent;
> }
AFAICT there's nothing here that should cause the 503s. Do you have
any limits set, be it connection or rate limit?
--- appa
proxy_set_header Host $http_host;Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221572,221582#msg-221582
> glubs !!! header host looks like "the missing culprit", I'll check
> it out to confirm your nice guess Mit Rowe
444 closes the connection. Doesn't return any 503 code.
--- appa
I know i know ...it's commented out
> --- appa
>
> _______________________________________________
> nginx mailing list
> ng...@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221572,221639#msg-221639
To see my config let's say it is as follow (not all parameters to let it
be clearer):
====================== /etc/nginx/sites-enabled/mydomain
server {
listen 80;
server_name mydomain.com www.mydomain.com sub1.mydomain.com
sub2.mydomain.com sub3.mydomain.com
error_page 502 503 504 400 /50x.html;
error_page 404 /404.php;
large_client_header_buffers 4 4k;
location = /50x.html {
root /var/www/mydomain/static/;
}
location ~* \.(jpg|jpeg|gif|png|css|bmp|ico|txt|html|swf)$ {
root /var/www/mydomain/
expires 1y;
}
location / {
proxy_pass http://127.0.0.1:60080/;
proxy_redirect off;
........
}
}
So my goal is to define a new vhost so that all requests reaching my
nginx which don't fit any of my server names (all subdomains) are
responded as one of 2 :: 404 returned or forwarding to another external
URL (...whatever it fits better for SEO)
====================== /etc/nginx/sites-enabled/mydomain
server {
listen 80 default_server;
server_name _;
error_log /var/log/nginx/000default-error.log error;
location / {
proxy_set_header Host $host;
#return 404;
rewrite .* http://doesnotexist.com permanent;
}
}
I must say I tested (sure badly i did ) the proxy_set_header (not sure
what for in my case) and still the same behaviour .....all my clients
away :(
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221572,221640#msg-221640
This can be made much simpler:
server {
listen 80 default_server;
server_name _;
error_log /var/log/nginx/000default-error.log error;
return 301 http://doesnotexist.com;
}
This redirects to a new host.
For returning a 404 just do:
return 404;
I think that 444 is preferable. No business trying to access a host
that doesn't exist. But it's up to you.
Enable the debug log and set:
proxy_intercept_errors on;
Trace the requests and see how are the 503s generated.
http://nginx.org/en/docs/debugging_log.html
--- appa
server {
listen 80 default_server;
server_name _;
proxy_intercept_errors on;
error_log /var/log/nginx/000default-error.log debug;
access_log /var/log/nginx/000default-access.log;
return 444;
}
below this block came the 3 vhost I serve, all of them with plenty of
server_name's.
More "clues" I surely shoud have given at my first post ::
.- Architecture :: AWS Elastic Load Balancer ====> 2 nginx each one
proxying to its own apache2
.- My php application relies a lot on apache redirects in htaccess of
the style: .*whatever/ .*whatever.php
.- As soon as i enable the above block, Server seems to respond Ok but
the 000default-access.log starts to be filled with:
..-[A] Plenty of requests responded with the 444 code
.- [B] Plenty of strange request like this :::
[01/Feb/2012:12:13:40 +0100] "-" 400 0 "-" "-"
.- In less than 3 minutes, suddenly the above access log stops receiving
that bunch of 444 responded requests[A] and it only shows the [B] from
time to time (some buffer overloaded?)
Just to say, the debug level and logs probably I did not use it well as
it is not adding actual extra info. should it be added to in the rest of
the server blocks below the default one?
like an X-File to me ......don't know what else to do or try
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221572,221854#msg-221854
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221572,221905#msg-221905
The thing now is I have following block and it works quite right. But If
I mean to use the commented return 444 instead of the rewrite ==> al my
web start returning 503 !!! and nothing's functioning .......always the
strange things to me.
server {
listen 80 default_server;
server_name _;
error_log /var/log/nginx/000default-error.log error;
location / {
proxy_set_header Host $host;
rewrite .* http://somewherelse.net permanent;
#return 444;
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221572,224230#msg-224230
Er, WTF?
You use the non-standard 444 ("444 closes the connection without
sending any headers") and you expect your downstream to do something
with that *other* than correctly respond to requests with a 503
Service Unavailable?
What you describe is *exactly* what I'd expect to see.
Either your understanding/expectations are faulty, or you haven't
explained yourself correctly.
Jonathan