How to create virtual host on Apache.

Yesterday, my boss wanted to start his new domain on old web server. I ever heard about apache could start many domain on one server by virtual host. I tried to find document for configuration and I found….



1. Change ServerName variable in /etc/httpd/conf/httpd.conf to your IP Address.

NameVirtualHost 192.168.0.3

2. Create virtual host by add below these lines in /etc/httpd/conf/httpd.conf :

<virtualhost>

ServerAdmin  admin@aoddy2.com
DocumentRoot  /var/www/html/aoddy2
ServerName  www.aoddy2.com
ErrorLog  /var/www/html/aoddy2/logs/error_log
TransferLog  /var/www/html/aoddy2/logs/access_log

</virtualhost>
<virtualhost>

ServerAdmin  admin@aoddy3.com
DocumentRoot  /var/www/html/aoddy3
ServerName  www.aoddy3.com
ErrorLog  /var/www/html/aoddy3/logs/error_log
TransferLog  /var/www/html/aoddy3/logs/access_log

</virtualhost>

3. Restart httpd service

# service httpd restart

Perfect !!!! Woooo :D

Related Posts

Leave a Reply

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

*

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">