Apache and IIS coexist, and the server uses port 80 externally

Source: Internet
Author: User

Apache and IIS share port 80 for the efficiency of PHP and ASP execution, IIS and Apache should be installed on the server, but port 80 cannot be used at the same time; otherwise, one of them must not be started. To allow them to coexist and access the website without adding a port number, the solution is as follows:

Method 1:
Iis5, coexistence under multiple IP addresses, IIS is 219.153.70.20., Apache is 219.153.70.252
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 use adsutil. vbs to set this attribute, but this setting does not work. Features in IIS 6.0 are newly added core-level DriversProgramPart of HTTP. sys. To configure HTTP. sys, you must use httpcfg.exe

Method 2:
IIS6: coexistence of multiple IP addresses. IIS is 219.153.70.20., and Apache is 219.153.70.252.
support/tools/support. Cab under Cd 2003. Decompress the httpcfg.exe file and copy it to the Windows/system32/directory. For more information, see
command line
bind it to an IP address: httpcfg set iplisten-I 219.153.70.133
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 219.153.70.20.< br> command line
net stop apache2
net stop IISADMIN/Y
Net start apache2
Net start w3svc
make sure that the IP address under IIS is set to global default, in Apache, when listen 219.153.70.252: 80 is set in httpconf, the two services can run simultaneously without conflict.
the IIS access address is http: // 219.153.70.20., and the Apache access address is http: // 219.153.70.252

Method 3:
Set Apache to port 80, IIS to use other ports, such as 81, and then use Apache as the proxy of IIS. Speed is affected.
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.

<Virtualhost *: 80>
Servername www.xiaotai.com
Proxypass/http: // localhost: 81/
Proxypassreverse/http: // localhost: 81/
</Virtualhost>

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

To use the second method, you can configure PhP4 on IIS and PhP5 in apache2. You only need to install PhP4 in IIS and set PHP. copy INI to the \ Windows directory. 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: // 219.153.70.20., and the Apache access address is http: // 219.153.70.252.

One server can coexist with other servers, such as JPS, ASP, PHP, and Asp.net. Apache, tomcat, and IIS can also coexist based on the above ideas.

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.