1. First you need to create an appropiate directory for virtual host. (Using the example of creating an intranet)
$ su –
$ useradd intranet
$ chmod 755 /home/intranet # needed for apache nobody process
$ cd /home/intranet
$ mkdir www logs
$ cd www
$ echo “<html>
<head>
<title>intranet test index</title>
</head><body></body></html>
” > index.htm
2. Second, you need to reconfig Apache Httpd for virtual host management.
$ cd /opt/httpd/conf
echo “Include conf/httpd.include” >> httpd.conf
$ vi httpd.include
NameVirtualHost 111.111.111.111 <VirtualHost 111.111.111.111> ServerAdmin [email protected] DocumentRoot /home/intranet/www ServerName intranet.site.com.au ServerAlias intranet LogLevel info ErrorLog /home/intranet/logs/error.log CustomLog /home/intranet/logs/access.log combined </VirtualHost>
3. Reboot Apache Httpd
$ apachectl graceful