Apache Virtual Host Domain Register Config, How to Add New Website to Apache

Apache Virtual Host Domain Register Config, How to Add New Website to Apache

Adding a new domain to apache is very easy. Here is how to do it on ubuntu server.  if you are not using ubuntu this maybe little bit different.

Get into the “/etc/apache2/sites-available” folder and open your 000-default.conf file and add as many domains as you want.

 

<VirtualHost *:80>
    ServerName yourdomainname.com
    ServerAlias www.yourdomainname.com
    ServerAdmin webmaster@yourdomainname.com
    DocumentRoot /var/www/yourdomainname.com

    <Directory /var/www/yourdomainname.com>
        Options -Indexes +FollowSymLinks
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/yourdomainname.com-error.log
    CustomLog ${APACHE_LOG_DIR}/yourdomainname.com-access.log combined
</VirtualHost>

 

after the editing config do not forget to restart your apache

service apache2 restart

 

Leave the first comment