Welcome! Log In Create A New Profile

Advanced

Name based virtual hosts not working

March 12, 2016 12:40AM
Hi!

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 /var/www/domain2/html
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;

server_name domain1.com www.domain1.com;

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

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


/zzyber
Subject Author Posted

Name based virtual hosts not working

zzyber March 12, 2016 12:40AM

Re: Name based virtual hosts not working

Anoop Alias March 12, 2016 02:38AM

Re: Name based virtual hosts not working

Kevin \"Ingwie Phoenix\" Ingwersen March 12, 2016 12:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 174
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready