Expertise level: Easy
To add a VirtualHost entry, follow this procedure:
- Login to your server as root in an ssh session.
- Make a copy of the current httpd.conf file (the path of the file may be different).
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
- Open the file /etc/httpd/conf/httpd.conf using your favourite text editor.
- Navigate to the end of the file and add the VirtualHost entry in the following format:
<VirtualHost 10.10.10.10:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin webmaster@domain.com
DocumentRoot /home/user/public_html
ScriptAlias /cgi-bin /home/user/public_html/cgi-bin
<IfModule mod_suphp.c>
suPHP_UserGroup user user
</IfModule>
</VirtualHost>
Make sure you have entered the correct IP address using one of your server's IPs.
DocumentRoot directory is the web files directory.
- Save the file and exit.
- Restart Apache using this command:
/etc/init.d/httpd restart
Verify if the document root directory "/home/user/public_html" is accessible through the browser when accessing http://yourdomain.com (The domain must resolve on the IP address you have entered into the VirtualHost).
0 Comments