how to setup apache webserver to start from OS boot in linux

how to setup apache webserver to start from OS boot in linux

i am using apache 2.2.17 on centos 5.7 which is equilent to redhat 5.7
my apache instance is running under /app/local/apache2.2.17


wasmanIT AnalystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steven CarnahanNetwork ManagerCommented:
According to http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-apache-startstop.html


By default, the httpd service does not start automatically at boot time. If you would wish to have Apache startup at boot time, you will need to add a call to apachectl in your startup files within the rc.N directory. A typical file used is rc.local. As this starts Apache as root, it is recommended to properly configure your security and authentication before adding this call.

You can also configure the httpd service to start up at boot time, using an initscript utility, such as /sbin/chkconfig, /usr/sbin/ntsysv, or the Services Configuration Tool program.

0
xtermCommented:
If you're running a custom instance of Apache, you won't have the normal init scripts in /etc/init.d

You need to create one yourself, or get one from the samples directory.

Do "find /app/local/apache2.2.17 | grep init"  - do you see a file called httpd.init or apache.init?  If so, you can copy that into /etc/init.d/httpd and use that as your new startup script.  Then you can simply do "/sbin/chkconfig --levels 2345 httpd on" and it will enable it on all subsequent boots.

Alternatively, you can simply put the full command that you use now in /etc/rc.local (you will likely have to create this because it doesn't exist by default anymore.)  So:

touch /etc/rc.local
chmod 755 /etc/rc.local
<open /etc/rc.local in text editor and add the following line>
/app/local/apache2.2.17/bin/apachectl start

(or whatever you use to start your server normally)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wasmanIT AnalystAuthor Commented:
Thanks you
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

wasmanIT AnalystAuthor Commented:
xterm
what is the --levels 2345 ? can you please explain it more

i got this from man pages , but couldn't understand

 --level levels
              Specifies the run levels an operation should pertain to. It is given as a string of numbers from 0 to 6. For example, --level 35 specifies
              runlevels 3 and 5.
0
xtermCommented:
Runlevel 1 is single user mode.
Runlevel 6 is system shutdown.

Runlevel 3 is the normal multiuser environment
Runlevel 5 is the graphical (X-windows) environment.

The system boots into your environment as specified by inittdefault in /etc/inittab (usually 3 or 5)

But since the system init scripts don't really know for sure which runlevel people will choose, the safest bet is to tell Apache (or any process) 2345 which really means "start me up in any of runlevels 2 or 3 or 4 or 5" and then also "terminate me in runlevels 1 or 6".

Make sense?
0
Steven CarnahanNetwork ManagerCommented:
The runlevels are:

0 - System halt; no activity, the system can be safely powered down.
1 - Single user; rarely used.
2 - Multiple users, no NFS (network filesystem); also used rarely.
3 - Multiple users, command line (i.e., all-text mode) interface; the standard runlevel for most Linux-based server hardware.
4 - User-definable
5 - Multiple users, GUI (graphical user interface); the standard runlevel for most Linux-based desktop systems.
6 - Reboot; used when restarting the system

So --levels 2345 mean it applies to all but single user and reboot.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.