How to setup 2 domains on the server

It’s for Debian/Ubuntu

First you need to add configuration files to /etc/apache2/sites-available/   (not, sites-enabled !!!)

Let’s suppose you have domain1.com and domain2.com, you need to create the files domain1.com and domain2.com and this code :

<virtualhost *:80>
Servername domain1.com
ServerAlias domain1.com
Documentroot “/var/www/domain1.com”
<Directory “/var/www/domain1.com”>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</virtualhost>

Just the same for domain2.com, then please type in console – “sudo a2ensite domain1.com”, “sudo a2ensite domain2.com”, after you’ve successfully added new web-sites, please reload apache  “service apache reload” and that’s all. Hope, I helped.

 

Leave a Reply

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