Linux Start / Stop / Restart Apache Server

by lifeLinux on December 30, 2011

I’m using Apache server in CentOS / RHEL / Debian / Ubuntu and I’d like to start, stop or restart my apache server after making some changes to configuration settings. How do I start/stop/restart apache server ?

CentOS / RHEL

If you are using CentOS / RHEL then type the following commands

Start Apache server

# service httpd start

Stop Apache server

# service httpd stop

Restart Apache server

# service httpd start

You can also use following commands:

# /etc/init.d/httpd start
# /etc/init.d/httpd stop
# /etc/init.d/httpd restart

Please note that restart option is a shorthand way of stopping and then starting the Apache Server. You need to restart server whenever you make changes to configuration settings. It is also good idea to check configuration error before typing restart option:

# httpd -t

Sample outputs

Syntax OK

Debian / Ubuntu

If you are using Debian / Ubuntu then type the following commands

Start Apache server

# service apache2 start

Stop Apache server

# service apache2 stop

Restart Apache server

# service apache2 start

You can also use following commands:

# /etc/init.d/apache2 start
# /etc/init.d/apache2 stop
# /etc/init.d/apache2 restart

Related Posts:

Previous post:

Next post: