Step 1. Edit httpd.conf
C:\XAMPP\apache\conf\httpd.conf,
C:\XAMPP\apache2\conf\httpd.conf,
C:\Bitnami\wampstack\apache\conf\httpd.conf
C:\Bitnami\wampstack\apache2\conf\httpd.conf
Change the line with
Listen 80
To 8080 or other, free ports.
Listen 8080
ensure that is included:
Include conf/extra/httpd-vhosts.conf
Step 2. Setting Virtual host
Open httpd-vhosts.conf file
C:\XAMPP\apache\conf\extra\httpd-vhosts.conf then add
<Directory C:/vhost>
AllowOverride All
Require all granted
</Directory>
# this is the default address of XAMPP
<VirtualHost *:8080>
DocumentRoot "C:/XAMPP/htdocs/"
ServerName localhost
</VirtualHost>
#this is the first vhost address in XAMPP
<VirtualHost *:8080>
DocumentRoot "C:/vhost/project1/"
ServerName php.localhost
SetEnv NS_ENV variable_value
</VirtualHost>
# this is the second vhost address in XAMPP for project like Laravel
<VirtualHost *:8080>
DocumentRoot "C:/vhost/Laravel-Blog/public"
ServerName laravel.localhost
</VirtualHost>
Step 3. Edit Windows Host file
edit hosts in C:\windows\system32\drivers\etc
127.0.0.1 localhost
127.0.0.1 php.localhost
127.0.0.1 laravel.localhost
127.0.0.1 codeigniter.localhost
127.0.0.1 wordpress.localhost
127.0.0.1 laravel2.localhost