Location served by all virtual servers

blu nginx-forum at nginx.us
Mon Jan 5 18:11:08 UTC 2015

Hi, I have some configuration issue with my nginx. Currently both URLs
return the same page when I open: 
http://domain1.com/SharedFIles and http://domain2.com/SharedFiles.

Location "SharedFiles" is definied only in one virtual server (domain2)
however it is accessible from both domains. How come? 
I'd like to have it only in a way that only domain2.com serves SharedFiles

What's wrong? THank you!

Here are two config files (doamin1 and domain2) I have in sites-available:

file domain1:
server {
	listen   80; ## listen for ipv4; this line is default and implied
	root /home/pi/webapps/domain1/public_html;
	index index.html index.htm;
	server_name *.domain1.com;

file domain2:
server {
    listen   80;
    server_name *.domain2.com;
    access_log /home/pi/webapps/domain2/logs/nginx-access.log;
    error_log /home/pi/webapps/domain2/logs/nginx-error.log;
    location /SharedFiles {
        root /media/Seagate/Video;
	auth_basic "Restricted";
	auth_basic_user_file /etc/nginx/.htpasswd;
	autoindex on;

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,255955,255955#msg-255955

More information about the nginx mailing list