Welcome! Log In Create A New Profile

Advanced

Re: Default_server catch all block not working

January 25, 2012 10:39AM
Ok as I started thinking later ....what for do I need proxy_set_header if my intention is to not proxy to Apache any request fall onto this catch all default_server ?

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 :(
Subject Author Posted

Default_server catch all block not working

lockev3.0 January 24, 2012 10:26AM

Re: Default_server catch all block not working

António P. P. Almeida January 24, 2012 10:36AM

Re: Default_server catch all block not working

Mit Rowe January 24, 2012 11:52AM

Re: Default_server catch all block not working

lockev3.0 January 24, 2012 12:57PM

Re: Default_server catch all block not working

lockev3.0 February 02, 2012 07:10AM

Re: Default_server catch all block not working

António P. P. Almeida January 24, 2012 02:52PM

Re: Default_server catch all block not working

lockev3.0 January 25, 2012 09:50AM

Re: Default_server catch all block not working

lockev3.0 January 25, 2012 10:39AM

Re: Default_server catch all block not working

lockev3.0 February 01, 2012 06:32AM

Re: Default_server catch all block not working

António P. P. Almeida January 25, 2012 11:18AM

Re: Default_server catch all block not working

lockev3.0 March 22, 2012 12:32PM

Re: Default_server catch all block not working

lockev3.0 March 28, 2012 04:11AM

Re: Default_server catch all block not working

Jonathan Matthews March 28, 2012 12:12PM

Re: Default_server catch all block not working

lockev3.0 April 16, 2012 04:43AM

Re: Default_server catch all block not working

Maxim Dounin April 19, 2012 08:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 115
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready