1, open httpd.conf, find listen:80, in the following line to join the listen:8080;
2, find #include conf/extra/httpd-vhosts.conf, the line before the # removed;
3, open the httpd.conf file directory under the Extra folder under the Httpd-vhosts.conf file;
4, find Namevirtualhost *:80, in the following line to increase the namevirtualhost *:8080;
5, copy the httpd-vhosts.conf file at the bottom of the following code, and paste a copy below:
Copy Code code as follows:
<virtualhost *:80>
ServerAdmin webmaster@dummy-host.abc.com
DocumentRoot "G:\PHP"
ServerName dummy-host.abc.com
Serveralias www.dummy-host.abc.ccom
ErrorLog "Logs/dummy-host.abc.com-error.log"
Customlog "Logs/dummy-host.abc.com-access.log" common
</VirtualHost>
<virtualhost *:80>
ServerAdmin webmaster@dummy-host2.abc.com
DocumentRoot "G:\PHP"
ServerName dummy-host2.abc.com
ErrorLog "Logs/dummy-host2.abc.com-error.log"
Customlog "Logs/dummy-host2.abc.com-access.log" common
</VirtualHost>
6, the above code modified to:
Copy Code code as follows:
<virtualhost *:8080>
ServerAdmin webmaster@dummy-host.abc.com
DocumentRoot "G:\PHP\ABC"
ServerName dummy-host.abc.com
Serveralias www.dummy-host.abc.ccom
ErrorLog "Logs/dummy-host.abc.com-error.log"
Customlog "Logs/dummy-host.abc.com-access.log" common
</VirtualHost>
<virtualhost *:8080>
ServerAdmin webmaster@dummy-host2.abc.com
DocumentRoot "G:\PHP\ABC"
ServerName dummy-host2.abc.com
ErrorLog "Logs/dummy-host2.abc.com-error.log"
Customlog "Logs/dummy-host2.abc.com-access.log" common
</VirtualHost>
7, save and restart Apache.
Note:
1, the above code is mainly modified port and directory, 80 port corresponding directory for the g:\php,8080 port corresponding directory for the G:\PHP\ABC;
2, the new added port corresponding directory must be under the Apache directory;
3, open http://localhost:8080 can access the G:\PHP\ABC directory.
Here are some additional information:
When we want to configure more than one virtual machine host and think the port is different, I find a lot on the internet is nonsense ... This afternoon I concluded by the end of the afternoon the Apache configuration of multiple ports has been finished.
First of all, add a include/etc/httpd/conf/51buyhost.conf under the http.conf, then you will know. Oh
Next, look down ...
Copy Code code as follows:
Namevirtualhost *:8080
#
Listen 8080
<virtualhost *:8080>
DocumentRoot "/var/www/html/goodfoison"
#ServerName Jb51.net (comments are not available, because only IP access)
ServerName 192.168.0.50
Serveralias 192.168.0.50
<directory "/var/www/html/goodfoison" >
Allow from all
Options +indexes
</Directory>
</VirtualHost>
#szlise. com
Listen 8081
<virtualhost *:8081>
DocumentRoot "/var/www/html/szlise"
#ServerName Jb51.net (comments are not available, because only IP access)
ServerName 192.168.0.50
Serveralias 192.168.0.50
<directory "/var/www/html/szlise" >
Allow from all
Options +indexes
</Directory>
</VirtualHost>
: Wq exit
I slowly study ....
And then open the corresponding port inside the firewall.