It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In RegisterIt looks like you're new here. If you want to get involved, click one of these buttons!
Howdy, Stranger!
It looks like you've been lurking for a while.
If you register, we also will remember what you have read and notify you about new comments. You will also be able to participate in discussions.
So if you'd like to get involved, register for an account, it'll only take you a minute!
This article provides troubleshooting steps for the Apache webserver .
If you have an issue with your site or webserver, firstly you should check your Apache status.
1) Debian/Ubuntu:
sudo systemctl status apache2
2) CentOS:
systemctl status httpd
If it isn’t, go ahead and restart Apache:
1) Debian/Ubuntu:
sudo service apache2 restart
2) CentOS:
sudo service httpd restart
Even if Apache is already operating, restarting the server might be helpful. This allows you to view the Apache starting message. If you receive an error, you can use the error text in an internet search to find further information.
Reloading enables Apache to reread its configuration files and implement the changes without requiring a full restart, avoiding downtime for the web server. Run the following command to refresh Apache's configuration:
1) Debian/Ubuntu:
/etc/init.d/apache2 reload
2) CentOS:
/etc/init.d/httpd reload
To check for Apache errors, you can try to use the tail command with the -f flag, which shows you the most recent part of the log live as it’s updated. For instance:
tail -f /var/log/apache2/error.log
1) Debian/Ubuntu:
cat /var/log/apache2/error.log
2) CentOS:
cat /var/log/httpd/error_log
The access logs can also help you find specific information about visitors to your server. The default access log locations are:
1) Debian/Ubuntu:
/var/log/apache2/access.log
2) CentOS:
/var/log/httpd/access_log
Apache includes a syntax checking tool. You can use it to make sure you aren’t missing any brackets in your configuration files (and similar problems):
1) Debian/Ubuntu:
apache2ctl -t
2) CentOS:
httpd -t
There is another Apache tool that lets you see all the virtual hosts on the server, their options, and the file names and line numbers of where they are defined.
It helps to identify all the domains that are configured on the server. Further, it helps to locate the correct file of the domain where the configuration details should be updated.
1) Debian/Ubuntu:
apache2ctl -S
2) CentOS:
httpd -S
Explanation of the received output:
All your directives use IP addresses and port numbers that match the ones defined in the NameVirtualHost directives.
For example, if you have set NameVirtualHosts *:80, then the virtual host configuration should begin with:
If you make changes to a configuration option but don't see them take effect after reloading the server configuration, it's conceivable that a conflicting directive has overruled the new option. The most important thing to understand is that newer commands take precedence over previous ones that clash. As a result, the directive that has been read the most recently will always take effect.
Here are some points on how the directories are read:
If you still have an issue with troubleshooting your Apache web server, then it might take a deeper investigation of your VPS. So you might need to consult with VPS administrator.
Also, for more information about Apache webserver, you can find here.