How to restart apache Under Linux

Every time you make config changes to Apache, you have to restart the server. If you’re suffering the death of a thousand clicks trying to use a GUI to do this simple task, here’s a tip that’ll get it done quick and easy.

If you’
re like me (read: not a seasoned sysadmin) you’

ve probably taken the GUI root to restarting Apache. Whether weaving through the RedHat Control Panel or by simply closing your Windows DOS window, you may have thought “There’
s got to be a better way!”

Well, there is.

Restarting Apache Under Linux

OK, here are the magic one-liners for your hungry command line:


/etc/rc.d/init.d/httpd restart



(See the Apache Documentation for all the command line flags.)


kill -TERM `cat /usr/local/apache/logs/`

(See the Apache Documentation for more options.)

Restarting Apache Under Windows

Well if you insist upon using a non-open OS with this open sever, OK. I’

ll assume you’
re running Apache under NT, and that you’
ve set it up as a service. Instead of futzing with the Services window, these one-liners can save you time by entering them in the RUN menu or from a DOS prompt.





If you need to set up Apache as a service under NT, check out the Apache Windows Documentation. If you’

re running Windows 95/98, you can restart or stop it by opening up a DOS window and issuing the following commands.


apache -k restart


apache -k shutdown

More information on Windows commands and configs are available in Apache’
s Windows Documentation

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.