• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

Restart Apache server

An web server (Apache) is running on a Linux (RedHat9) server. I have root privilege to this server. The web server was running but now it seems not to be running. I cannot get to the web URL to the web server. How can I check from command prompt that the server is running/not running. If not running, how to restart it?
0
tooki
Asked:
tooki
  • 2
1 Solution
 
mrielfCommented:
To check:
List running process with "ps ax"

To restart:
/etc/init.d/apache restart
or
/etc/init.d/apache2 restart


0
 
periwinkleCommented:
Mrielf's general approach is good; however, let me expand a bit.

There are several ways to check to see if the web server is running:

   ps ax | grep -i httpd                                                
or
   apachectl status

or the start-up script, which is probably located in:

   /etc/rc.d/init.d

although in some setups, it may be located in the /etc/init.d directory that mrielf has indicated.  The script may be called any of the following (the name is arbitrary and depends upon your setup):

   apache
   apache2
   httpd

I'm going to assume for this exercise that it is called httpd, but you can substitute your correct name.  

To check the status using the startup script, you can use:

   /etc/rc.d/init.d/httpd status

To restart the server if it is entirely down, you will want to have a slightly different command if you are running SSL or if you are not.

With SSL, you can use either:

   apachectl startssl                                            
or
   /etc/rc.d/init.d/httpd startssl

Without SSL, you can use either:

   apachectl start                                              
or
   /etc/rc.d/init.d/httpd start

If you cannot locate your apachectl command (i.e. it is not in your path), try issuing the following commands to locate it:

  cd /
  find . -name apachectl
0
 
tookiAuthor Commented:
apachectl start  
Above command worked for me.
Thanks!
0
 
periwinkleCommented:
Glad to assist, tooki!
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now