Welcome! Log In Create A New Profile

Advanced

Re: Conflicting server name - i don't understand

ktm
September 02, 2009 03:05AM
I don't know what's happening here, i'm posting at the nginx forums and I saw the responses on some mailing list by mistake and not at the forums. I'm not really sure if nginx forum is integrated with mailing list or maybe i understand wrong.

Anyway if i add this
server_name_;return 444;

to one vhost , it works fine, no errors

Is this configuration ok Igor ? Those if's are rewrites of joomla .htaccess file. Also do i need to put server_name_;return 444; to every vhost or just to one vhost is enough ? It seems that nginx give no errors if I just add to one vhost.I use nginx 0.7.61.

Thank you for your help

[code]
server {
listen 80;
server_name www.digitalfav.com;

#redirect www to non-www
rewrite ^/(.*) http://digitalfav.com/$1 permanent;


}


server {
listen 80;
server_name digitalfav.com;
access_log /home/digitalfav/log/access.log;
error_log /home/digitalfav/log/error.log;



location / {
root /home/digitalfav/public/;
index index.php index.html;
expires 30d;

#stop image and files hotlinking
location ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip|jpeg|css)$ {
valid_referers none blocked digitalfav.com www.digitalfav.com *.google.com *.yahoo.com;
if ($invalid_referer) {
return 444;
}
}

#joomla sef url's
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
}

if ( $args ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3d)" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}

if ( $args ~ "base64_encode.*\(.*\)" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}

if ( $args ~ "(\<|%3C).*script.*(\>|%3E)" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}

if ( $args ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}

if ( $args ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}


# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/digitalfav/public_html/$fastcgi_script_name;
}
}


server {
server_name_;return 444
## Only allow GET and HEAD request methods
if ($request_method !~ ^(GET|HEAD)$ ) {
return 444;
}
## Deny illegal Host headers
if ($host !~* ^(digitalfav.com|www.digitalfav.com)$ ) {
return 444;
}
## Deny certain User-Agents (case insensitive)
## The ~* makes it case insensitive as opposed to just a ~
if ($http_user_agent ~* (Baiduspider) ) {
return 444;
}

## Deny certain Referers (case insensitive)
## The ~* makes it case insensitive as opposed to just a ~
if ($http_referer ~* (babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversoftware|sex|teen|video|webcam|zippo) ) {
return 444;
}

## Serve an empty 1x1 gif _OR_ an error 204 for favicon.ico
location = /favicon.ico {
#empty_gif;
return 204;
}


## All other errors get the generic error page
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
500 501 502 503 504 505 /error_page.html;
location /error_page.html {
internal;

}

}
[/code]
Subject Author Posted

Conflicting server name - i don't understand

ktm September 01, 2009 05:10PM

Re: Conflicting server name - i don't understand

ktm September 01, 2009 05:51PM

Re: Conflicting server name - i don't understand

ktm September 02, 2009 03:05AM

Re: Conflicting server name - i don't understand

ktm September 02, 2009 03:37AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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