To create a virtual host, go to the last line of your httpd.conf. You will see an example there. Just copy-n-paste the example and make the necessary changes. To create a virtual host, just do this much:
NameVirtualHost *:80
ServerAdmin webmaster@sarin.net.in
DocumentRoot /var/www/mydomain
ServerName mydomain.co.in
ErrorLog logs/mydomain-error_log
CustomLog logs/mydomain-access_log common
Now create the directory.
mkdir /var/www/mydomain
echo My homepage > /var/www/mydomain/index.html
Change the ownership of the directory
chown -R apache.apache /var/www/mydomain
Now, just restart httpd
service httpd restart
Note 1: You can create multiple virtual host entries by repeating
Note 2: I have noticed that log file names cannot be same. They have to be different for different domains.
No comments:
Post a Comment