How to Configure Multiple Domains in Web Server

Step 1: Prerequisite

Step 2: Add Domains in Apache Configuration File

To add multiple domains in web server edit /etc/http/conf/httpd.conf file and create virtual hosts.

# vi /etc/http/conf/httpd.conf
NameVirtualHost 10.0.0.10
<VirtualHost *:80>
    ServerAdmin webmaster@tecdistro.com
    DocumentRoot /var/www/html/tecdistro.com
    ServerName www.tecdistro.com
    ServerAlias tecdistro.com
    ErrorLog /var/log/tecdistro.com-error_log
    CustomLog /var/log/tecdistro.com-access_log common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@tecdistro.org
    DocumentRoot /var/www/html/tecdistro.org
    ServerName www.tecdistro.org
    ServerAlias tecdistro.org
    ErrorLog /var/log/tecdistro.org-error_log
    CustomLog /var/log/tecdistro.org-access_log common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@tecdistro.net
    DocumentRoot /var/www/html/tecdistro.net
    ServerName www.tecdistro.net
    ServerAlias tecdistro.net
    ErrorLog /var/log/tecdistro.net-error_log
    CustomLog /var/log/tecdistro.net-access_log common
</VirtualHost>

Step 3: Restart Apache Server

After the changes have made, Restart the apache server:

# service httpd restart
OR
# /etc/rc.d/init.d/httpd restart
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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

seventeen − sixteen =