So, I installed 2 virtual host files, example1.com and example2.com with the following information:
- first file
<VirtualHost 127.0.0.1:80> ServerName example1.com ServerAlias www.example1.com ServerAdmin admin@example1.com DocumentRoot /var/www/example1.com </VirtualHost>
- second file
<VirtualHost 127.0.0.1:80> ServerName example2.com ServerAlias www.example2.com ServerAdmin admin@example2.com DocumentRoot /var/www/example2.com </VirtualHost>
and configure my hosts file to read
127.0.0.1 locahost 127.0.0.1 example1.com 127.0.0.1 example2.com
But if I try to go to localhost, example1.com or example2.com, my browser will just send me to example1.com
default virtual host file:
<Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
Suppose AllowOverride for / var / www takes precedence over a rule?
So, I later just turned off all my virtual hosts with a2dissite and commented out these lines in the hosts file, but half of my sites didn’t work at all.
One of my Wordpress sites didn’t seem to have pulled out its css file, so all of it was disabled (this was normal 24 hours ago), a couple of sites seemed to have lost contact with the database.
I have no idea what is happening, but everything is upset.
edit - in my original question there were both virtualhost files pointing to example1.com, which was a copy error, the actual files point to valid website URLs