How to share port 80 between IIS and Apache

Source: Internet
Author: User

For debuggingProgramThe local machine is installed with IIS and Apache, and port 80 cannot be used at the same time. The solution is as follows:

Method 1:

Iis5, coexistence under multiple IP addresses, IIS is 192.168.0.1, Apache is 192.168.0.2 original address
C: \ Inetpub \ adminscripts
Cscript adsutil. vbs set w3svc/disablesocketpooling true
The command returns the following disablesocketpooling: (Boolean) True
Restart IIS
Inetpub \ adminscripts> cscript adsutil. vbs set w3svc/disablesocketpooling true
Because disablesocketpooling is defined as a valid attribute in the IIS 6.0 metabase architecture (mbschema. XML), you can still set this attribute using adsutil. vbs, but this setting does not work. Features in IIS 6.0 are part of the new core-level driver HTTP. sys. To configure HTTP. sys, you must use httpcfg.exe

Method 2:

IIS6, coexistence under multiple IP addresses, IIS is 192.168.0.1, Apache is 192.168.0.2 original address
To support/tools/support. Cab under Cd 2003. Decompress the httpcfg.exe file and copy it to the Windows/system32/directory.

Command Line

Bound to an IP address: httpcfg set iplisten-I 192.168.0.1
That is, the command uses IIS to only listen to the specified IP address and port
View binding: httpcfg query iplisten
Delete binding: httpcfg Delete iplisten-I 192.168.0.1

Command Line
Net stop apache2
Net stop IISADMIN/y
Net start apache2
Net start w3svc

Make sure that the IP address in IIS is set to the global default. If the listen 192.168.0.2: 80 parameter is set to httpconf in Apache, the two services can run simultaneously without conflict.
The IIS access address is http: // 192.168.0.1, And the Apache access address is http: // 192.168.0.2.

Method 3:

The commonly used method for sharing port 80 with a single IP address on the Internet is not recommended, but it is only used as an Apache proxy. The speed may affect the configuration of Apache to port 80, and IIS to use other ports, such as 81, then, use Apache as the proxy for IIS.

In httpd. conf, uncomment the following four lines:
Loadmodule proxy_module modules/mod_proxy.so
Loadmodule proxy_connect_module modules/mod_proxy_connect.so
Loadmodule proxy_http_module modules/mod_proxy_http.so
Loadmodule proxy_ftp_module modules/mod_proxy_ftp.so

Create a VM to redirect all access requests from the domain name to port 81.

Servername iloves.vicp.net
Proxypass/http: // localhost: 81/
Proxypassreverse/http: // localhost: 81/

In this way, you can use both Apache and IIS functions by using only one port.

Likewise, you can configure PhP4 and PhP5 in apache2 on IIS by installing PhP4 in IIS and setting PHP. copy INI to the \ Windows directory. You don't need to worry about this. In apache2, you only need to copy PhP5 PHP. put ini in the PhP5 installation directory.

Configure Apache to support PhP5:

Loadmodule php5_module "D:/phpserver/PhP5/php5apache2. dll"
Addtype application/X-httpd-PHP. php
Directoryindex index.html index. php
Phpinidir "D:/phpserver/PhP5"

The most important one is phpinidir, which is used to specify PHP. INI file location, that is, the installation directory of PhP5. Note that all directories should be changed to the format D:/phpserver/PhP5 instead of D: \ phpserver \ PhP5, the IIS access address is http: // 192.168.0.1, And the Apache access address is http: // 192.168.0.2.

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.