Windows Apache Multi-Port Virtual Host configuration Method _linux

Source: Internet
Author: User
Tags comments

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.

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.