Name based virtual hosts not working

zzyber nginx-forum at
Sat Mar 12 05:40:53 UTC 2016


I just did a lemp setup but I can't get my virtual hosts to work properly.
I´m totally lost and out of ideas.
Two domains and one starting on e is always responding showing its root and
the other starting on s is just dead. I understand that nginx is handling
this as Apache analyzing the headers for a match and if no match it goes
alphabetically taking the first as default domain.

I have my configuration files in /etc/nginx/conf.d, domain1.conf and
domain2.conf and the root pointing to /var/www/domain1/html and 
The domains are pointed A records to my public IP

What can be wrong here? So many people having this problem but I can´t find
a solution. I hope this forum are holding cutting edge professionals to help
me out.

config file 

server {
    listen 80;

    root /var/www/domain1/html;
    index index.php index.html index.htm;


    location / {
            try_files $uri $uri/ /index.php;

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_param SCRIPT_FILENAME
            include fastcgi_params;
            fastcgi_pass unix:/var/run/php5-fpm.sock;


Posted at Nginx Forum:,265259,265259#msg-265259

More information about the nginx mailing list