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

Facebook Comments

More Stuff

How to Install Piwik (Alternative to Google Analytics) in Linux This tutorial will guide you on how to install Piwik open source analytics application in CentOS 7 and in Debian 9 and Ubuntu Server 16.04 LTS edition...
President Bolsonaro should boost Brazil’s entrepreneurial ecosyste... Romero Rodrigues Contributor More posts by this contributorBrazil’s fintech boom offers new vertical opportunities for investors Brazil’s tech-se...
Kali Linux – Fresh Installation Guide Kali Linux is arguably one of the best out of the box Linux distributions available for security testing. While many of the tools in Kali can be insta...
Deal Learn Python 3 with This 9-Course Python Bootcamp Bundle Python is a powerful, versatile and easy-to-learn programming language used to easily develop everything from websites, operating system components, s...
Spread the love

Posted by News Monkey