当前位置: 动力学知识库 > 问答 > 编程问答 >

compilation - How to install two Apache services

问题描述:

I would like two install two different apache2.2 services on a Windows machine. I already have one installed and running on ports 80 and 443. I copied the server installation directory and pasted it some where else. I went into httpd.conf and changed it from Listen 80 to Listen 8000. I also changed the Listen 443 to Listen 8001.

I can install it as a service, but it says there is an error in httpd.conf.

When I try to start the service it says:

make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down

Nowhere in the config file does it say to listen to port 80.

What could cause this?

EDIT

I found that if I changed the config file in the original Apache installation that I copied, it would change the error message.

For example I changed the original config files to listen on ports not in use and the error messages, when I try to start the new Apache service, would go away. However, in task manager it did not show the Service as running but as STOPPED.

I uninstalled the service and re-installed it using the -f flag to point to the correct config file and nothing changed. It seems there must be internal pointers or something that are kept when I copied it?

I also tried installing Apache from a .msi installer and it wont install because I already have an apache installation.

SECOND EDIT

Wish I would have seen this earlier. According to Using Apache HTTP Server on Microsoft Windows I may need to build Apache from source.

Note that you cannot install two versions of Apache 2.3 on the same computer with the binary installer. You can, however, install a version of the 1.3 series and a version of the 2.3 series on the same computer without problems. If you need to have two different 2.3 versions on the same computer, you have to compile and install Apache from the source.

I have never done something like this could some one perhaps explain this a little more clearly?

网友答案:

The solution was going into the original Apache install directory and running:

C:\original-apache-install\bin> httpd -k install -n "new service name" -f "new/config/file/location"

Just copying the installation and pasting somewhere else kept ties to the original config file and did not let me change what it pointed to. When I ran the above command in the new install directory it did not work. Example:

C:\new-pasted-apache\bin> httpd -k install -n "new service name" -f "new/config/file/location"
网友答案:

I successfully installed two different 2.4.x versions of apache by installing both services separately with the command that was already mentioned:

C:\Apache2.4.23> httpd -k install -n "Apache2.4.23" -f "C:/Apache2.4.23/conf/httpd.conf"

C:\Apache2.4.12\bin> httpd -k install -n "Apache2.4.12" -f "C:/Apache2.4.12/conf/httpd.conf"

When i checked both services in the "Services" interfaces of windows i noticed that the seconds service had the same executable path as the first installed service. I fixed that by editing the service via regedit (since the sc command did not accept the parameter "-k runservice" that is appended to the executable path):

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

See: http://superuser.com/questions/222238/how-to-change-path-to-executable-for-a-windows-service/252850#252850

分享给朋友:
您可能感兴趣的文章:
随机阅读: