Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to bring up another instance of Apache? 2

Status
Not open for further replies.

SirCharles

Programmer
Jun 10, 2002
212
US
Can you just copy current httpd executable to another area on disk, change the config file in the new area, and the startup script to bring up another instance of Apache? Or do you need to recompile the httpd executable?

Otherwise, what is recommended procedure?
Last time I did this, I recompiled everything as I needed to add some modules anyway. I did this after moving all the source for all the modules to the new area. It involved recompiling all the modules first. Where I'm not adding or removing any modules...
 
One for a production version and one for a development or testing version.
 
Do you really need a separate instance of Apache for that? Wouldn't virtual hosts do?

//Daniel
 
If your OS is Linux/*nix then yes you can install or compile Apache into another directory structure but you obviously cannot use the same port (unless you have 2 IP addresses {probably even on a virtual interface eth1:1?}) anyway.

Web appliances like Colbalt RAQ's run one instance for production (user facing) and another instance for Administration (admin user facing).

You just need to be careful with lock files and ports (all in the httpd.conf.

Good Luck
Laurie.
 
So, you have to re-compile? Or can I just move the executable over and modify the httpd.conf config file?
 
You should be able to use the same executable, just supply command line switches for which configuration file to use.

//Daniel
 
Ok .... Answer:

I just did the following on my test server (Red Hat 7.2 with Apache 1.3.27) here:

1) cp /usr/sbin/httpd /usr/sbin/httpd2
2) cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd2.conf
3) vi /etc/httpd/conf/httpd2.conf and:
a) change port to 81
b) change any ref for lock,scoreboard, log files etc to have an appended 2 after the 'httpd' part
c) made document root to be /var/ d) saved file
4) mkdir /var/5) cp /var/ /var/6) vi /var/ and add some big CLUE WORD
7) chmod -R 755 /var/
Then finaly
8) /usr/sbin/httpd2 -f /etc/httpd/conf/httpd2.conf
This starts the second webserver (othere was and is already running on port 80)

Oh and from a browser do: and there is my other site, knock off the 81 and my orig site is there too

Easy or what?

For production you will need to be a bit more thorough though!

Good Luck
Laurie.
 
What Daniel says is true, no real need to copy /usr/sbin/httpd .... but it just helps {me} disinguish whats running what at a quick glance of ps -ef | grep httpd2 :¬)

L.
 
Thanks to Laurie and Daniel. I also had to create an httpd.pid file with different number in it. Because
I'm referencing the 2nd run of apache from different location, the grep shows that up as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top