Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: Multiple apache instances |
|
Author |
|
Qmpeltaty
Joined: 06 Feb 2008 Posts: 182 Location: Poland
|
Posted: Fri 15 Jun '12 15:20 Post subject: Multiple apache instances |
|
|
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
|
Posted: Fri 15 Jun '12 16:13 Post subject: |
|
|
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
|
Posted: Sat 16 Jun '12 10:11 Post subject: |
|
|
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
|
Posted: Mon 18 Jun '12 14:02 Post subject: |
|
|
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
|
Posted: Wed 27 Jun '12 13:04 Post subject: |
|
|
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
|
Posted: Thu 28 Jun '12 13:49 Post subject: |
|
|
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 |
|
|
|
|
|
|