Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have finished setting up nginx for virtual hosting, this is how my config files look like

server {
    listen 80;
    access_log /home/;
error_log /home/;
    location /static {
            root /home/;
location / {
    try_files $uri @uwsgi;
location @uwsgi {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/domain_uwsgi.sock; 

on the same machine, I have and, each when i access I get its content which is great. My problem is that when i try to access the user using the IP address i get one of the sites in the virtual hosts too..

Although i disabled the default (removed the symbolic link) from sites-enabled folder but still not solved it for me.

any suggestions?

share|improve this question
up vote 4 down vote accepted

You may handle such requests by creating the default webserver configuration like this:

server {
    listen 80 default;
    server_name localhost;

This option is called default_server since 0.8.21. See documentation for details.

share|improve this answer
thanks this is helpful :) – Mo J. Mughrabi Jun 24 '12 at 17:23

Just insert a catch all block and restrict access to every other request to your IP.

server {
    listen 80 default_server;
    server_name _;
    return 444;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.