I'm trying to configure Debian Jessie 8 VPS with Apache & PHP-FPM to serve multisite.
This is my /etc/hosts
file.
127.0.0.1 localhost
127.0.1.1 subdomain.mysite.com
127.0.1.1 site1.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
Where subdomain.mysite.com is my hostname. And site1.com is one of my websites. The sites are enabled by using the command sudo a2ensite site1.com.conf
My Apache VirtualHost
file in /var/www/site1.com/
look like this.
<VirtualHost *:8080>
ServerName site1.com
ServerAlias www.site1.com
ServerAdmin myemail
DocumentRoot /var/www/site1.com/web
ErrorLog /var/www/site1.com/logs/error.log
CustomLog /var/www/site1.com/logs/access.log combined
<Directory "/var/www/site1.com/web">
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
I'm using port 8080 because of Varnish.
The problem is when I try to configure a second domain. I've configure the VirtualHost exactly like the first one, changing the path to the files.
I don't know how to configure /etc/hosts
to add the new domain, I've tried to configre adding a the second domain next to the first, but doesn't work.
127.0.1.1 site1.com site2.com
If I change the 127.0.1.1 with my server static IP, doesn't work neither.
mystaticip site1.com site2.com
I need help. Thank you very much.
The following host file does the trick for me:
# /etc/hosts
127.0.0.1 localhost servername.yourdomain.com
# A.B.C.D stands for your IPv4 address
A.B.C.D servername.yourdomain.com servername
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters