Failed to Start, Stop, Restart The Apache HTTP Server Ubuntu

If you are using apache 2 http server services like start, stop, reload, restart, and status, and you are getting some error like a job for apache2.service failed because the control process exited with an error code, see “systemctl status apache2.service” and “journalctl -xe” for details with result ‘exit-code. on your ubuntu linux terminal. To fix the error, you will need to create an error log file for Apache2, reinstall apache2, or change port.

Failed to Start, Stop, Restart The Apache HTTP Server Ubuntu

Here are three solutions to fix this error:

Solution 1: Create an Apache Error Log Directory

Firstly, you will need to open terminal window by pressing ctrl+alt+t on keyboard.

If there is no error log directory for Apache2 where it stores error logs, this is where you will not be able to start, stop, restart and reload the Apache server, you can use this command to fix the problem:

$ mkdir -p /var/log/apache2

Now you can start, stop and restart the Apache2 server, your error is fixed, for verify, you can use the commands.

sudo systemctl start apache2.service
sudo systemctl stop apache2.service
sudo systemctl restart apache2.service

Solution 2: Change Ports For Apache2

To change the ports of Apache2, you have to open the ports.conf file, you can do this with the help of this command:

sudo nano /etc/apache2/ports.conf

Now, in ports.conf you have to search port 80, and replace 80 with 8080 and save the file.

Now you also have to replace port 80 with 8080 in the 000-default.conf file. For this you type the command on the terminal:

sudo nano /etc/apache2/sites-enabled/000-default.conf

And also, in 000-default.conf you have to search port 80, and replace 80 with 8080 and save the file.

Now you can start, stop and restart the Apache2 server, and your error is fixed, for verify, you can use the commands.

sudo systemctl start apache2.service
sudo systemctl stop apache2.service
sudo systemctl restart apache2.service

Solution 3: Reinstall Apache2

If all else fails, you can consider installing Apache 2 on Ubuntu. First, remove Apache from your system:

sudo apt purge apache2
sudo apt install apache2

OR
sudo apt-get purge apache2
sudo apt-get install apache2

Here is the video guide to fix job for apache2.service failed because the control process exited with error code, see “systemctl status apache2.service” and “journalctl -xe” for details:

Conclusion

That’s it; you have learned how to fix failed to start, stop, and restart the apache http server on ubuntu.

Recommended Tutorials

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including 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. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

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