I am trying to configure virtual host on local web server What i want is when i go to localhost or server IP i want to see the default centos page and when i go to the other websites that are configured in /etc/hosts then i want to see those websites.
Is this the correct configuration for this setup? Its not working as i want..because now all websites go to default centos page which is not what i want.
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@web1.com
DocumentRoot /var/www/html/
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@web1.com
DocumentRoot /var/www/vhost/web1.com/html/
ServerName web1.com
ErrorLog /var/www/vhost/web1.com/logs/error.log
CustomLog /var/www/vhost/web1.com/logs/access.log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@web2.com
DocumentRoot /var/www/vhost/web2.com/html/
ServerName web2.com
ErrorLog /var/www/vhost/web2.com/logs/error.log
CustomLog /var/www/vhost/web2.com/logs/access.log common
</VirtualHost>