Start, Restart, Stop Apache2 Server in Ubuntu 20.04|22.04

Start, Restart, Stop Apache2 Server in Ubuntu 20.04|22.04

Apache 2 is a popular web server software used to host websites and serve web content. It’s important to know how to start, restart, and stop Apache 2 when you’re managing a web server. So, In this tutorial, you will learn how to start, stop and restart apache2 server on ubuntu command line.

How to Start, Restart, Stop Apache2 Server in Ubuntu 20.04|22.04

Steps to start, restart, and stop Apache 2 on Ubuntu 20.4|22.04;

  • Start Apache2 Ubuntu
  • Stop Apache2 Ubuntu
  • Restart Apache2 Ubuntu
  • Check Status Apache2

Start Apache2 Ubuntu

To start the Apache2 web server ubuntu, you can use the following command:

sudo systemctl start apache2

Stop Apache2 Ubuntu

To stop the Apache2 web server, you can use the following command:

sudo systemctl stop apache2

Restart Apache2 Ubuntu

To restart the Apache2 web server (for example, after making configuration changes), you can use the following command:

sudo systemctl restart apache2

Important Note:- If you start, restart, and stop the apache2 server and you get failed to start/stop, restart apache2.service unit apache2.service not found ubuntu or job for apache2.service failed because the control process exited with error code, then you can fix this type of error with failed to start/stop and restart the apache2 http server ubuntu tutorial.

Check Status Apache2

You can check the status of the Apache 2 service using the following command:

sudo systemctl status apache2

This command will provide information about whether Apache 2 is running, its current status, and recent log messages. This can be helpful for troubleshooting.

Remember, it’s important to have superuser (root) privileges to perform these actions, which is why we use sudo.

Please note that in some versions of Ubuntu, you might come across the old service command instead of systemctl. The service command works similarly, but systemctl is the newer and more preferred way of managing services in modern Ubuntu versions.

Some additional commands for Enabling and Disabling Apache2 on Boot

To make Apache2 start automatically when your system boots up, you can enable the service with this command:

sudo systemctl enable apache2

Conversely, if you want to disable Apache2 from starting at boot time, you can use:

sudo systemctl disable apache2

Conclusion

In summary, managing the Apache2 web server on Ubuntu 20.4| 22.04 involves starting it with sudo systemctl start apache2, restarting it using sudo systemctl restart apache2, and stopping it using sudo systemctl stop apache2.

Recommended Tutorials

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

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