
# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
DocumentRoot "/www/example1"
ServerName www.example.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/www/example2"
ServerName www.example.org
# Other directives here
</VirtualHost>
Ubuntu Apache path to create virtual host
/etc/apache/sites-available/yourdomain.conf
Centos Virtual host
/etc/httpd/httpd.conf/yourdomain.conf
Nginx Virtual host
/etc/nginx/sites-available/yourdomian.conf
Window
D:\xampp\apache\conf\extra\httpd-vhost.conf
Remember to add hosts(domain name or IP ) in hosts file for local machine
linux – /etc/hosts
windows C:\Windows\System32\drivers\etc\hosts