Starting multiple instances of apache2 on server reboot

Hi,
I have multiple instances of apache2 reunning on a solaris 10 box. I want all the apache instances to automatically start once the physical server is rebooted.
Appreciete if someone can guide me how to modify the rc3.d script for doing this.

Thanks,
Mohit
Mohit_tAsked:
Who is Participating?
 
xtermCommented:
- Copy /etc/init.d/apache to /etc/init.d/apache2
- Edit /etc/init.d/apache2, comment out the line near the end that contains apachectl, and replace it with the command that you use to start your second instance of apache
- After you've tested the script to make sure it starts your other apache, then copy it to /etc/rc3.d/S50apache2

Keep in mind that this modified script will only work to START your 2nd instance of apache - it will not work to STOP apache.
0
 
PapertripCommented:
Is there a specific reason you are running multiple Apache instances on the same box?
0
 
arnoldCommented:
You can configure a single controlled instance to listen on multiple IPs, and ports.
Please provide additional details on your question.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Mohit_tAuthor Commented:
Hi,
Yes we are using multiple websites as one site caters to normail users and the other website is for text base browsers. We use the same code base but filter out JS and other fancy stuff for text base browsers. I think running multiple websites on one box vs running them on different boxes is not negotiable.

We are running virtual solaris 10 containers and have one VIP assigned to each virtual box, so we are running multiple apache instances on one box on different ports. Also there are FW and Load Balancers in between.

arnold please let me know what further details you need.
We are running multiple apache instances and want to modify rc3.d script so that all the apache instances come up on server reboot. Right now we have to manually start all the apache instances.
OS: Solaris 10
Apache: apache2.2

Appreciate help of all the gurus and geniuses.

Thanks
0
 
PapertripCommented:
You can run both websites from the same Apache instance using virtual hosts.  It's a very common practice with lots of documentation and examples.  I don't even remember the last time I setup Apache and not used virtual hosts.

Check out http://httpd.apache.org/docs/2.0/vhosts/
You will want to setup name-based vhosts -  http://httpd.apache.org/docs/2.0/vhosts/name-based.html

Examples -- http://httpd.apache.org/docs/2.0/vhosts/examples.html

You should be able to get all you need accomplished by reading through those links, it even has examples of exactly what you are trying to do with the multiple instances.
0
 
arnoldCommented:
If you don't want to consolidate the multiple configuration into a single instance that will include the various others, you should copy the apache2 start script and adjust each start script to match the settings you want.
Another option depending on your scripting skills, you could modify the apache2 to have the capacity to start all the instances you want.

You are using the svcadm, rather than the legacy scripting.
You can use svccfg to export the existing apache service and then import a modified one as a new service per instance.

http://www.cims.nyu.edu/cgi-systems/man.cgi?section=1M&topic=svccfg



Do you have a reverse proxy that handles the differentiation between the regular access and the text only?

0
 
AnacreoCommented:
You should find out if you have your first httpd instance running via SMF:


159 / >svcs http
STATE          STIME    FMRI
disabled       Sep_21   svc:/network/http:apache2

If so then you'll want to clone the service and start a new one:
There is a good write up at (http://www.petertribble.co.uk/Solaris/smf.html)

But you'd basically do:
cp /lib/svc/method/httpd-apache2 /lib/svc/method/site-httpd-apache2

cp /var/svc/manifest/network/httpd-apache2.xml /var/svc/manifest/site/httpd-apche2.xml

Edit both files as appropriate, the first to start the apache instance you want, the second to point to the first file with any applicable parameters, also make sure to change the service name.

Now import them:
/usr/sbin/svccfg -v import /var/svc/manifest/site/httpd-apche2.xml

From the link here is good advice on troubleshooting it:

# svcs -vx smtpd (replace this with httpd, here and below)
svc:/network/smtp:postfix (postfix SMTP mail transfer agent)
 State: online since Wed Feb 09 11:05:04 2005
   See: man -M /etc/postfix/man -s 1 postfix
   See: /var/svc/log/network-smtp:postfix.log
Impact: None.
I found that the easiest way to correct a fault in the manifest was to edit the file, then delete the entry and re-import the file. :-

svcadm -v disable svc:/network/smtp:postfix
svccfg -v delete svc:/network/smtp:postfix
svccfg -v import /var/svc/manifest/site/postfix.xml
0
 
AnacreoCommented:
In my previous post...

If the command
# svcs http

If it returns disabled, you'll want to follow previous poster about copying the legacy /etc/init.d script.

If it returns enabled, you may want to consider my advice.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.