Locate the configuration file httpd.conf and open it with the editor.
Before adding a port, we can see if the port has been opened and the command is as follows:
Window View Port:
# View All ports
$ netstat-n-A
# See if Port 8081 is occupied
$ NETSTAT-AON|FINDSTR "8081"
Mac View Port:
Lsof-i Tcp:port
To confirm that a port is not in use, set the port. We add a port to the httpd.conf configuration file and open the virtual host.
Add Port:
Listen 8081
To open a virtual host:
Instead, open the virtual host as follows.
Save and close the httpd.conf file.
Then hit the conf/extra/httpd-vhosts.conf file and configure the port information:
<virtualhost *:8081> ServerAdmin [email protected] documentroot "c:/phpdocroot/site1" ServerName localhost serveralias localhost errorlog "logs/dummy-host.localhost-error.log" customlog "logs/ Dummy-host.localhost-access.log "Common <directory" c:/phpdocroot/site1 "> Options Indexes FollowSymLinks allowoverride None Order allow,deny allow from all </Directory> </ Virtualhost>
Windows Apache Port configuration