How to configure Apache multi-port and multi-site

Source: Internet
Author: User

Configure httpd. conf
Listen to multiple ports

CopyCode The Code is as follows: # Listen: allows you to bind Apache to specific IP addresses and/or
# Ports, instead of the default. See also the <virtualhost>
# Directive.
#
# Change this to listen on specific IP addresses as shown below
# Prevent Apache from glomming onto all bound IP addresses.
#
# Listen 12.34.56.78: 80
Listen 8081.
Listen 8082.
Listen 8083.

# Adding listening ports
After setting the following content, you can use netstat-n-a to check whether the port is enabled.
Enable Virtual SiteCopy codeThe Code is as follows: # Virtual Hosts
# Include CONF/extra/httpd-vhosts.conf
# Change
# Virtual Hosts
Include CONF/extra/httpd-vhosts.conf

Configure the PHP Module
When the PHP module is loaded, php5apache2_2 indicates that apache2.2 or a later version is used.
Loadmodule php5_module "C:/PHP/php5apache2_2.dll"
Phpinidir "C:/PHP"
Configure PHP file type ing
Addtype application/X-httpd-PHP. php

Configure CONF/extra/httpd-vhosts.conf

Copy code The Code is as follows: <virtualhost *: 8082>
Serveradmin webmaster@dummy-host.localhost
DocumentRoot "C:/phpdocroot/Site1"
Servername localhost
Serveralias localhost
Errorlog "log/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>
<Virtualhost *: 8083>
Serveradmin webmaster@dummy-host2.localhost
DocumentRoot "C:/phpdocroot/Site2"
Servername localhost
Errorlog "log/dummy-host2.localhost-error.log"
Customlog "logs/dummy-host2.localhost-access.log" common
<Directory "C:/phpdocroot/Site2">
Options indexes followsymlinks
AllowOverride none
Order allow, deny
Allow from all
</Directory>
</Virtualhost>
<Directory...>... </directory>

Must not be less
Restart Apache and try again. If an error occurs, check the log file under logs and the error log recorded by Windows event viewer.

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.