logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Multiple apache instances
Author
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Fri 15 Jun '12 15:20    Post subject: Multiple apache instances Reply with quote

Hello

I want to run two Apache instances on my server (no i don't want virtual host for that) to spread dynamic content from static content.

Currently installed Apache instance hosts both - dynamic and static content - dynamic i mean frontend for JBoss Application Server. Static : jpg, swf etc.

Apache is currently installed on C:\Apache2.2 with Listen 192.168.1.100:80 in httpd.conf

I've installed new instance to C:\Apache2.2-static directory using same installation file by command :

Code:

msiexec /a httpd-2.2.21-win32-x86-openssl-0.9.8r.msi /qb TARGETDIR=c:\Apache2.2-static


I have copied httpd.conf from 192.168.1.100, changed Listen to 192.168.1.101:80, and all paths from C:\Apache2.2 to c:\Apache2.2-static and then installed service by command :

Code:

C:\Apache2.2-static\httpd.exe -k install -n "Apache 2.2-static"


Service has been installed successfuly.

When i try to run the service (from command line, from services etc.) i got error :


Code:

httpd.exe: Could not reliably determine the server's fully qualified domain name
, using 192.168.1.100 for ServerName
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions.  : make_sock: could not bind to address 192.168.1.100:80
no listening sockets available, shutting down


I've checked it all multiple times and config for static Apache contains Listen 192.168.1.101:80, so how could it gives such error ?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7364
Location: Germany, Next to Hamburg

PostPosted: Fri 15 Jun '12 16:13    Post subject: Reply with quote

Maybe a different programm blocks that port.
e.g. Anti virus, firewall, skype, teamviewer, etc

You can use this program to check out if a program is listening on that port (doesn't detect anti virus nor firewall) http://dl.dropbox.com/u/40218896/setups/xampp-portcheck.exe
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Sat 16 Jun '12 10:11    Post subject: Reply with quote

James Blond wrote:
Maybe a different programm blocks that port.
e.g. Anti virus, firewall, skype, teamviewer, etc

You can use this program to check out if a program is listening on that port (doesn't detect anti virus nor firewall) http://dl.dropbox.com/u/40218896/setups/xampp-portcheck.exe


The first Apache instance blocks this port. The case is that i want to run TWO apache instance on same machine

1st : 192.168.1.100:80
2nd : 192.168.1.101:80

When you read my first post carefully, all has been wrote there. The problem is that 2nd Apache want to listen on 1.100:80 inspite of configuration file which is 1.101:80. Thats the case.
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Mon 18 Jun '12 14:02    Post subject: Reply with quote

Any help about it ? Is there any way to run two Apache on same machine ?
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Wed 27 Jun '12 13:04    Post subject: Reply with quote

I have managed to run multiple instances. First and main instance is from apache.org installed from .msi and other instances from apachelounge unpacked and installed manually.

The only think i have to remember of is not to restart Apache from services, but from command line with -n "Service_name".
Back to top
Baardmans



Joined: 02 Feb 2012
Posts: 7
Location: Holland

PostPosted: Thu 28 Jun '12 13:49    Post subject: Reply with quote

Do the two separate instances need to be different versions of Apache?

If you do not need two different versions of Apache (which i assume is your situation) you only need and should install one .msi but create two services that use two different configuration files.

So install one msi, go to command prompt and input (change the paths to your situation):

C:\Apache2.2\httpd.exe -k install -n "Apache 2.2-static" -f "c:\Apache2.2\conf\static.conf"

C:\Apache2.2\httpd.exe -k install -n "Apache 2.2-dynamic" -f "c:\Apache2.2\conf\dynamic.conf"

Next step will probably be to set up the static server as proxy, i have the following configuration for that in place in the static configuration (again change paths/urls to your situation):
# Setup the proxy to send php files to the other server
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ProxyPreserveHost On
RewriteEngine On
RewriteCond %{REQUEST_URI} !.*\.(gif|png|jpg|bmp|pdf|swf|txt|js|ico|css|mp3|zip|rar|exe|msi)$
RewriteRule ^/(.*) http://127.0.0.1:8070/$1 [P]
ProxyPassReverse / http://127.0.0.1:8070/

and on the dynamic server I have remoteip module in place so that the apache service behind the proxy gets the right ip.
LoadModule remoteip_module modules/mod_remoteip.so
RemoteIPHeader X-Forwarded-For
RemoteIPProxiesHeader X-Forwarded-By
RemoteIPTrustedProxy 127.0.0.1

Hope that helps.
Back to top


Reply to topic   Topic: Multiple apache instances View previous topic :: View next topic
Post new topic   Forum Index -> Apache