Hi All,
I currently have two domains pointing to my digital ocean LAMP Server. I have a directory for each domain in the /var/www directory. /var/www/domain1 and /var/www/domain2. I also kept the /var/www/html directory as default.
I have created a .config file for each directory in /etc/apache2/sites-available/ domain1.config and domain2.config. See below:
<VirtualHost * :80> ServerName domain1 ServerAlias www.domain1 ServerAdmin webmaster@localhost DocumentRoot/var/www/domain1 Errorlog $(APACHE LOG DIR}/error.log Customlog $(APACHE LOG DIR}/access.log combined </VirtualHost>
<VirtualHost * :80> ServerName domain2 ServerAlias www.domain2 ServerAdmin webmaster@localhost DocumentRoot/var/www/domain2 Errorlog $(APACHE LOG DIR}/error.log Customlog $(APACHE LOG DIR}/access.log combined </VirtualHost>
I then enable both virtual hosts with: sudo a2ensite domain1 sudo a2ensite domain2 sudo systemctl reload apache2
when I type in my browser www.domain1.com the correct website is served. However, if I type www.domain2.com the domain1 website is served.
The only way I can get www.domain2.com website to run is by turning off the first virtual host
sudo a2dissite domain1 sudo systemctl reload apache2
Now if I type www.domain2.com the correct website is displayed.
What can I do to enable both sites?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!