How to prevent processing requests with undefined server names on nginx 1.1.17
HKS VIETNAM
contact at hksvietnam.com
Mon Mar 26 11:32:56 UTC 2012
Dear Team,
My OS: Centos 5.8
My nginx 1.1.7
Apache listen on: 8080
Nginx listen on: 80
nginx as reverse proxy.
My proxy.conf file
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
client_header_buffer_size 64k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 32 16k;
proxy_busy_buffers_size 64k;
My nginx config file:
server {
listen 80;
server_name "";
return 444;
}
server {
listen 192.168.1.3:80 default_server;
server_name www1.domain1.com;
access_log /var/log/nginx/www1.domain1.com.access.log main;
location / {
include proxy.conf;
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 192.168.1.3:80;
server_name forum.domain1.com;
access_log /var/log/nginx/forum.domain1.com.access.log main;
location / {
include proxy.conf;
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 192.168.1.3:80;
server_name www.domain1.com domain1.com;
access_log /var/log/nginx/www.domain1.com.access.log main;
location / {
include proxy.conf;
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 192.168.1.3:80;
server_name www.domain2.com domain2.com;
access_log /var/log/nginx/www.domain2.com.access.log main;
location / {
include proxy.conf;
proxy_pass http://127.0.0.1:8080;
}
}
My problem:
When I access undefined server names, ex: anything.domain1.com or
anything.domain2.com
I can still access, I want it to return 444.
How I fix my problem ???
Thank all team Nginx,
Nguyen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120326/d34dd4fd/attachment-0001.html>
More information about the nginx
mailing list