1, open httpd.conf, find listen:80, add listen:8080 in the following line;
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 following code at the bottom of the httpd-vhosts.conf file, and paste a copy below:
<virtualhost *:80>
ServerAdmin [email protected]
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 [email protected]
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. Modify the above code to:
<virtualhost *:8080>
Serveradmin [email protected]
documentroot "G:phpabc" &NBSP;
ServerName dummy-host.abc.com
Serveralias www.dummy-host.abc.ccom
errorlog logs/ Dummy-host.abc.com-error.log "&NBSP;
Customlog" logs/ Dummy-host.abc.com-access.log "COMMON&NBSP;
</virtualhost>
<virtualhost *:8080>
ServerAdmin [email protected]
DocumentRoot "G:PHPABC"
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 G:PHPABC;
2, the newly added port corresponding directory must be under the Apache directory;
3. Open http://localhost:8080 to access the G:PHPABC directory.
Here are some additional information:
When we want to configure multiple virtual machine host and also want the port is not the same case I find a lot of online is nonsense ... This afternoon I summed up an afternoon and finally put the multiple port Apache configuration done.
First, add a include/etc/httpd/conf/51buyhost.conf to the http.conf below, and you'll know. Oh
Next look down ...
Namevirtualhost *:8080
#
Listen 8080
<virtualhost *:8080>
DocumentRoot "/var/www/html/goodfoison"
#ServerName Jb51.net (commented out temporarily, because only with 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 (commented out temporarily, because only with 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
Self-study slowly oh ....
Then open the corresponding port in the firewall.
Ding Feng Hu Jiashong
qq.2881064155
skype.live:2881064155
Windows Apaches How to configure a virtual host using a multiport port