Commands for Starting Apache on Linux

If your Linux Apache Web server is stopped, you can use a specific command-line command to get it running again. Nothing will happen if the server has already been started when the command is executed, or you might see an error message like "Apache web server is already running."

If you're trying to install Apache and not just start it, see our guide on how to install Apache on Linux. See how to restart an Apache web server if you're interested in shutting down Apache and then starting it back up.

How to Start an Apache Web Server

If Apache is on your local machine, you can run these commands as is, or else you'll need to remote into the server using SSH or Telnet.

For example, ssh will SSH into the Apache server.

The steps for starting Apache are slightly different depending on your version of Linux:

For Red Hat, Fedora, and CentOS

Versions 4.x, 5.x, 6.x, or older should use this command:

$ sudo service httpd start

Use this command for versions 7.x or newer:

$ sudo systemctl start httpd.service

If those don't work, try this command :

$ sudo /etc/init.d/httpd start

Debian and Ubuntu

Use this command for Debian 8.x or newer and Ubuntu 15.04 and above:

$ sudo systemctl start apache2.service

Ubuntu 12.04 and 14.04 might require this command:

$ sudo start apache2

If those aren't working, try one of these:

$ sudo /etc/init.d/apache2 start
$ sudo service apache2 start

Generic Apache Start Commands

These generic commands should start Apache on any Linux distribution:

$ sudo apachectl start
$ sudo apache2ctl start
$ sudo apachectl -f /path/to/your/httpd.conf$ sudo apachectl -f /usr/local/apache2/conf/httpd.conf
Was this page helpful?