- Edit /etc/httpd/conf/httpd.conf
Duplicate the following section (which is already in the httpd.conf file):
#NameVirtualHost 12.34.56.78:80
#NameVirtualHost 12.34.56.78
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
#
#<VirtualHost ip.address.of.host.some_domain.com>
# ServerAdmin webmaster@host.some_domain.com
# DocumentRoot /www/docs/host.some_domain.com
# ServerName host.some_domain.com
# ErrorLog logs/host.some_domain.com-error_log
# CustomLog logs/host.some_domain.com-access_log common
#</VirtualHost>
Modify the above section so that it looks something like:
NameVirtualHost 192.168.0.103
<VirtualHost 192.168.0.103>
ServerAdmin webmaster@mybox.mydomain.com
DocumentRoot /var/www/mybox.mydomain.com
ServerName mybox.mydomain.com
ErrorLog logs/mybox.mydomain.com-error_log
CustomLog logs/mybox.mydomain.com-access_log common
</VirtualHost>
FIXME: Double check that the above values are correct
- If you will be using a virtual ip, then here's how to do it
ifconfig eth0:0 192.168.0.103
route add 192.168.0.103
- Make sure you have the new directory created as you have shown for DocumentRoot in the above configuration section.
- Restart apache
/etc/rc.d/init.d/httpd restart
- Be sure to press the "reload" button in your browser if you have already tried to access the page before you finished setting it up.