Windows Apaches How to configure a virtual host using a multiport port

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.