Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How we can run two instance of Apache Http Server on same machine Windows 7

How we can run two instance of Apache Http Server on same machine Windows 7

I want to configure 2 apache http servers and 3 tomcat server on window7 machine.

Currently I have done configuration with 1 http server and 2 or more tomcat server, but unable to do configuration of 2 http servers on same windows machine.Whenever I start second time of http server(2nd instance) then is says like this:

httpd: Could not reliably determine the server's fully qualified domain name, 
using 172.17.124.181 for ServerName (OS 10048)Only one usage of each socket
address (protocol/network address/port) is normally permitted.:
make_sock: could not bind to address 0.0.0.0:80 no listening sockets available,
shutting down Unable to open logs

Please let me know how I can I run two instances of HTTP servers on same windows machine. Help is appreciated. Thanks in advance.

like image 631
dinu0101 Avatar asked Jun 06 '13 10:06

dinu0101


People also ask

Can we have two Apache Web server on a single machine?

Although you can certainly have a single installation of Apache httpd, running a single instance, and still have different virtual hosts that can be accessed separately, sometimes following this easy path can lead you to a heavy and bloated web server.

Can Apache listen on 2 ports?

As we can see, Apache is listening on two ports. On the top line, we can see port 8888, while the bottom line is for port 80.


3 Answers

Copy your current Apache files to another folder and modify the httpd.conf file. Change two things:

  • ServerRoot: give the path of the new folder where you have copied your apache files.

  • Listen: Give a new port number other than 80. It will be better if you give a port number larger than 1024.

Make sure you have not set the environment path for httpd.exe. if you have just remove it.

Now in the command prompt navigate to the bin folder of new server. then type the following command.

httpd.exe -k install -n "New Apache" -f "C:/path/to/httpd.conf"

(Of the new server).

Once you execute this command successfully, you'll find a new service named "New Apache" in services.msc. Start that service and in browser try to run the server with the new port number that you have given in the httpd.conf file of the new server.

Mostly that should work. But in case it doesn't execute the following command

httpd.exe -k config -n "New Apache" -f "C:\path\to\httpd.conf

Hope that helps!

like image 111
Shreyas Kothari Avatar answered Oct 23 '22 10:10

Shreyas Kothari


You'll have to run the 2nd Apache instance on a port other than port 80. Find the Listen directive in the httpd.conf file for the 2nd Apache instance and change the port.

like image 37
Steven M. Wurster Avatar answered Oct 23 '22 10:10

Steven M. Wurster


A 'Listen directive' tells a server to accept incoming requests on the specified ports, and a server can also be made to listen to address-and-port combinations.

If you specify a port number in the Listen directive, the server listens to that port on all interfaces. If you specify an IP address as well as a port, the server will listen on that port and interface.

For example, if you were to make the server accept connections on both port 80 and port 8000 on all the interfaces, you could try this:

Listen 80
Listen 8000

... but if you want to make the server accept connections on port 80 for one interface (e.g. 198.0.1.1), and port 8000 on the other (e.g. 198.0.2.2), you would write something like this:

Listen 198.0.1.1:80
Listen 198.0.2.2:8000
like image 44
Vikas Avatar answered Oct 23 '22 11:10

Vikas