Apache config file with multiple VirtualHosts

1 comment on Apache config file with multiple VirtualHosts

I wanted to be able to open sites like *.ladby.ru and *.lovecakes.ru besides main sites ladby.ru and lovecakes.ru. This is how I solved this problem – by editing Apache config file, making it much simpler and by using ServerNames instead of ServerAliases.


  	ServerName www.lovecakes.ru
  	DocumentRoot /var/www/lovecakes.ru/public/



	ServerName galina.lovecakes.ru
  	DocumentRoot /var/www/galina.lovecakes.ru/public/



	ServerName www.ladby.ru
  	DocumentRoot /var/www/ladby.ru/public/



	ServerName ladby.ru
  	DocumentRoot /var/www/ladby.ru/public/



 	ServerName club.ladby.ru
  	DocumentRoot /var/www/club.ladby.ru/public/

And this is how the tree looks like:
Снимок экрана 2014-08-13 в 16.57.17

Do not forget to reload Apache after editing conf file, which lies here: /etc/apache2/sites-available:

# sudo /etc/init.d/apache2 reload

So, now the following sites are working:
club.ladby.ru
ladby.ru
www.ladby.ru
lovecakes.ru
www.lovecakes.ru
galina.lovecakes.ru

Comments

One response to “Apache config file with multiple VirtualHosts”

  1. ddr Avatar

    in such configuration files of all users will be accessible for another virtualhosts.

Leave a Reply

Your email address will not be published. Required fields are marked *