restricting access only through domains on nginx on virtual hosts

Posted by Mo J. Mughrabi on Server Fault See other posts from Server Fault or by Mo J. Mughrabi
Published on 2012-06-23T22:10:27Z Indexed on 2012/06/24 3:18 UTC
Read the original article Hit count: 453

Filed under:

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

server {
    listen 80;
    server_name domain.com;
    access_log /home/domain.com/prod_webapp/logs/access.domain.com.log;
error_log /home/domain.com/prod_webapp/logs/error.domain.com.log;
    location /static {
            root /home/domain.com/prod_webapp/mocorner/ph/;
    }
location / {
    try_files $uri @uwsgi;
}
location @uwsgi {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/domain_uwsgi.sock; 
}}

on the same machine, I have domain1.com and domain2.com, 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?

© Server Fault or respective owner

Related posts about nginx