How to Troubleshoot Common Apache Issues on Linux Server?

Posted November 22, 2019 25.5k views
Linux BasicsApacheLinux Commands

I have been seeing this question quite a lot recently, so I decided to put together a few steps on what to do in case that your website is not loading.

If you are using Nginx, you could follow the steps here:

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
8 answers

I would recommend following these steps in case that you are having any problems with your Apache server and you are unsure about what the problem is:

  • Check if Apache is running:
systemctl status apache2

If Apache is running you should see something like this:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-11-19 09:37:46 UTC; 2 days ago

If Apache is not running then the output would look like this:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Fri 2019-11-22 08:41:01 UTC; 39s ago
  • If Apache is not running you could start it with:
systemctl start apache2

Then check the status agian and make sure that Apache remains running.

  • If Apache did not start after a reboot, you could enable it so that it starts after the next reboot:
systemctl enable apache2
  • Check your Apache config syntax:
apachectl -t

If you get an error, you would need to fix that problem and then you could restart Apache:

systemctl restart apache2
  • If you get Syntax OK when running apachectl -t then your configuration is correct, so I would recommend checking your error logs:
tail -f /var/log/apache2/error.log

With the -f argument, you would see the output of the log in real team, so you could visit your website via your browser, and you would be able to see the errors populating the log if there are any. To stop that, just press CTRL+C.

  • Check the permissions of the files and folders in your document root:

Find the user that your Apache service is running as:

ps auxf | grep apache

If you are using Ubuntu, the user should be www-data, so you would need to make sure that your files and folders are owned by that user, so Apache could read and write to those files:

chown -R www-data:www-data /var/www/

Note: be careful with the above command as it could mess up the ownership of all of your files if you don’t specify the path correctly.

  • Check if Apache is binding to the default ports:
netstat -plant | grep '80\|443'
  • Check if ufw allows TCP connections on port 80 and 443:
ufw status

If this is the case, you can follow the steps from this article here on how to configure your ufw:

That is pretty much it, with all of the above information you should be able to narrow down the problem.

For more information I would suggest checking out this article here:

Hope that this helps!

by Justin Ellingwood
Everybody runs into issues with their website at one point or another. This guide will help you troubleshoot some common issues and get your site running again.
  • Hi,
    I’m no way an expert (i’m actually learning to use Linux after a life in Windows ) but still from what I’ve read I’m not convinced that what you’re saying regarding ownership and permission is indeed the correct way to handle the matter. Why give ownership of the directory to the user that apache process is running as? once you’re a owner of a file/directory then you can set permission on it as you wish…and this means that if someone manages to impersonate the user that you’re running Apache as then he could actually delete or modify content that for example you wanted to be readonly. Why just not use the “other” part of the permission to grant read/execute permissions (as per request) and leave the ownership to different users than the one that process is running as?

    • Hey there,

      It really depends on the application itself. Let’s say that you have a WordPress website, if Apache is not able to write to document root directory then a lot of the functionality would fail.

      For example if you try to upgrade your WordPress core files, Apache will not be able to write to the wp-admin and wp-includes folders and the upgrade will fail, as when you hit the Upgrade button via your WordPress admin area, this triggers a process using the Apache user.

      The same goes for other functionality like uploading files or storing cache in WordPress.

      This will also be true for other CMSs and some frameworks.

      Of course, if you have a static website that does not expect any user input, you could do it as you mentioned.


for me helped to stop nginx and then start apache

sudo service nginx stop
sudo service apache2 start

Do I need to downgrade to PHP 7.2 or will PHP 7.3 do it. I use PHP 7.3 ON MY LOCAL SYSTEM and it works

When I used: systemctl status apache2

I got:

and, systemctl start apache2


Just totally confused.

What do I do?

  • Hi there @midowu,

    It sounds like that you already have another service listing on port 80, note that you can not have more than 1 service listening on one port.

    What you could do is:

    • sudo netstat -plant | grep 80

    That way will find which service exactly is listening on that port. Then you can stop it, for example, if it is Nginx listening on that port you can stop it with:

    • sudo systemctl stop nginx

    Then you can go ahead and start Apache as normal:

    • sudo systemctl start apache2

    Note that if you are already using Nginx for other services, you should move Nignx to another port for example 8080 rather than just stopping it.

    Hope that this helps!

When I stopped nginx using
sudo systemctl stop nginx

I was able to restart apache, but my application stopped running. I am unable to restart nginx. And some commands begin to fail

Also, when I ran some of the commands working before they failed. For instance:

sudo chgrp -R www-data storage bootstrap/cache

“no such file or directory exists”

The whole thing is just giving me stress

  • Hi there @midowu,

    In this case you need to choose which webserver you would like to you. You can’t have them both running on the same port.

    If your application already uses Nginx. Then stop Apache and start Nginx.


I have hosted application on Digital Ocean. And I made it to be https since I am using Azure AD for Login.

Laravel-5.8 and mysql

  1. How do I go about this now?
  2. Will Nginx work instead of Apache.
  3. Do it mean I will need re-configure the whole thing again?
  4. ???
  • Hello,

    If you only stoped Nginx, all you would need to do is to stop apache and start Nginx again. You will not have to reconfigure it.


  • Hello,

    The rest of the changes really depend on your setup.

    If you have already been using Nginx, then there is no need to add apache unless you have a specific plan and reason on why you need both.

    But even if you need both, you should never configure them on the same port.


  1. How do I disable Apache and start Nginx or Disable Nginx and start Apache.

  2. Also, which one is preferable for Laravel and Mysql Project Deployment. And also to be used as https.

  3. I think I mix up the initial configuration with both apache and Nginx. How do I now focus on Apache?

NB: I disabled PHP7.2 and enabled PHP7.3, but when I restarted apache and run php -v I am still seeing PHP7.2

I have a deadline to deliver it today.


Show answer This answer has been marked as resolved by midowu.

Thanks everything is resolved now. But how do I configure phpmyadmin to nginx and be able to open it on my domain as https://laravelapps/phpmyadmin.