How to Start/Restart/Stop the httpd Service

Written by Richi González Wednesday, 21 September 2011

Hello,

I have seen TONS of threads in forums asking how to restart the httpd service, and sometimes they only post one method. In this article I will tell you how to start it, restart it, or stop the httpd service with two different ways. You will need SSH root access.

Difficulty level: Easy

1. Establish a SSH connection and login as a root user.

The commands are as follows:

Start it:

/etc/init.d/httpd start
OR
service httpd start

Restart it:

/etc/init.d/httpd restart
OR
service httpd restart

Stop it:

/etc/init.d/httpd stop
OR
service httpd stop

2. Execute any of the needed commands, if one does not work, try the other one.

And that is all there is to it! It will now start/restart/stop, depending on what you needed!

Any questions, comments, suggestions, problems, even just to say hi; please do not hesitate to contact me! :)

Best Regards,
Richi
Owner of www.Juapo2Services.com

Looking for quality Linux Web Hosting? Try out Arvixe web hosting and you won’t be disappointed.




4 Comments

  1. Fabien   |  Monday, 26 November 2012 at 8:48 am

    when i try one of these commands it says permissions denied:
    /etc/init.d/httpd: line 15: ulimit: open files: cannot modify limit: Operation
    not permitted
    /etc/init.d/httpd: line 16: ulimit: open files: cannot modify limit: Operation
    not permitted
    /etc/init.d/httpd: line 17: ulimit: open files: cannot modify limit: Operation
    not permitted
    httpd: Could not open configuration file /usr/local/apache/conf/httpd.conf: Pe
    rmission denied

    .I m using Java SSH Login in arvixe cpanel to connect to the server. Is it because i m not a root user ? i ‘m using my cpanel username to connect and a public SSH key.

  2. Richi González   |  Thursday, 29 November 2012 at 8:29 pm

    Hello,

    Certainly. You need be logged in as root. Root access is allowed in VPS and Dedicated plans, check the packages at http://arvixe.com

    Anything else, let me know.

    Regards,
    Richi

  3. Stephane   |  Sunday, 20 January 2013 at 6:03 am

    Dear Richi,

    I searh for a shell script that’s restarts httpd service if it crash.
    How should I do that ?

    Like this pseudo code:

    if httpd don’t work {
    /etc/init.d/httpd restart
    }

    Thanks in advance,

    Stephane.

  4. Richi González   |  Sunday, 20 January 2013 at 1:54 pm

    Instead of restarting it when it crashes, better restart it periodically.

    –Richi

Leave a Reply






eight − 3 =