restricting access only through domains on nginx on virtual hosts
- by Mo J. Mughrabi
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?