How to Start, Stop and Restart Apache Ubuntu?

The most common question to every newbie on the apache web server is how to start, stop, or restart the apache ubuntu server on Linux and ubuntu systems. We cover all the possible options for you in the following guide. 

The common problem with newbies on the apache server is how to start, stop, and restart the apache server? There are no hard buttons and you don’t want to lose data. 

We cover the complete guide on how to start, stop, and restart apache on ubuntu systems. 

Pre-requisites –

  1. SUDO/ROOT access to the Apache webserver.
  2. Properly installed and configured Apache.

Compile and install  apache on ubuntu from the official documentation here

We use the command-line terminal to perform operations on the apache server and these commands are for ubuntu users with versions 16.04 and 18.04 and Debian 9.x users

Restart Apache Ubuntu Server

To restart apache on ubuntu systems, you can use the following command in the terminal window – 

sudo systemctl restart apache2

Restarting is a good practice when you make new software integrations or load new modules on your apache server. Make sure you save all your necessary configurations before restarting your apache server. 

If apache was previously disabled then you can use the status command in your terminal window to check the active state. Use the following command in terminal – 

sudo systemctl status apache2
restart apache ubuntu

These commands are helpful to start, stop, and restart apache on ubuntu systems with versions 16.04 and 18.04 and Debian 9.x users. 

Also read: How to check the version of Linux? Check Linux Version

There are other commands to start, stop, and restart apache on Debian Linux version 7.x or Ubuntu 14.10 or older.

Start Apache Ubuntu Server

To start the apache web server on your ubuntu system, type the following command – 

sudo systemctl start apache2

To check the status of the apache server and make sure it is running, use the following command – 

sudo systemctl status apache2

This command will display “Active ( running )” if the apache server is successfully running. If it does not display the active status, check for configurations or reinstall the apache server.

start apache ubuntu

Stop Apache Ubuntu Server

To stop apache, type the following command – 

sudo systemctl stop apache2

Make sure you save all the changes on your apache server before performing the stop apache command. 

You can check if the apache server is successfully stopped using the status command, type the following command in the terminal – 

sudo systemctl status apache2

In the status information if the message is ” inactive (dead) ” then you have successfully stopped the Apache server. 

stop ubuntu apache

Start, Stop, and Restart Apache on Debian Linux version 7.x or Ubuntu 14.10 or older using the following commands –

The command to Start Apache Ubuntu

To start the apache server we use the init operations on older ubuntu systems (14.10 or lesser) and Debian (7.x) and start apache.

# /etc/init.d/apache2 start

(or)

$ sudo /etc/init.d/apache2 start

(or)

$ sudo service apache2 start

Command to Stop Apache Ubuntu

To stop the apache server we use the same init operations on older ubuntu systems (14.10 or lesser) and Debian (7.x) and stop apache.

# /etc/init.d/apache2 stop

(or)

$ sudo /etc/init.d/apache2 stop

(or)

$ sudo service apache2 stop

Also read: How to delete files and directories in Linux – Simple Guide

Command to Restart Apache Ubuntu Server

To restart the apache server we use the same init operations on older ubuntu systems (14.10 or lesser) and Debian (7.x) and restart apache ubuntu.

# /etc/init.d/apache2 restart

(or)

$ sudo /etc/init.d/apache2 restart

(or)

$ sudo service apache2 restart

CentOS and Red Hat Linux – How to restart apache Ubuntu Server?

To start apache on CentOS and Red Hat Linux version – 

systemctl start httpd.service

Stop apache on CentOs and Red Hat Linux version – 

systemctl stop httpd.service

Restart apache ubuntu server on Centos and Red Hat Linux version – 

systemctl restart httpd.service

Also read: Things to do after installing Kali Linux – Most Important

Start, Stop and Restart Apache Ubuntu (Generic Method) –

To start apache ubuntu server using the generic method – 

apachectl -f /path/to/your/httpd.conf
apachectl -f /usr/local/apache2/conf/httpd.conf

Stop apache ubuntu server using the generic method – 

apachectl -k stop

Restart apache ubuntu server using the generic method – 

apachectl -k restart

Graceful Restart – 

apachectl -k graceful

Conclusion

Using the above commands you can start, stop, and restart the apache ubuntu server. 

Subscribe to our newsletter or join the telegram channel for more amazing tech related content.

You may also like,

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
free online courses with certificate

12 Best Free Online Courses With Printable Certificates 2021

Next Post
tenor gif keyboard

Tenor GIF keyboard for Android, IOS, and Mac – Best Gif Keyboard

Related Posts
Popup subscribe Form Tiny Quip

Connect

Some Catchy Line to Grab your Attention

Get Our Prime Content Delivered to your Inbox for Free!! Join the Ever-Growing Community… Right Now.

Total
0
Share