User Guide - Apache Web Server Troubleshooting


Applicable Plans - All eApps General VPS Plans

User Guide - Apache Web Server Troubleshooting

Overview

Because of the complexity of the Apache web server, it is impossible to provide any kind of comprehensive troubleshooting guide. It is often difficult to tell at first look if the web site or the web server is the actual problem, because one can look very much like the other. What is covered in this User Guide are some of the most common problems that occur.


This User Guide is a quick troubleshooting guide for the Apache web server. For more information on managing the Apache web server and your sites, see the following User Guides:

Note This User Guide is for troubleshooting the Apache web server, not an application server like Tomcat, JBoss, Ruby on Rails, or GlassFish. For information on troubleshooting sites using those application servers, see their specific User Guides - http://support.eapps.com/kb



Checking the status of the web server
Checking the web server status
Restarting the web server

Common Web Server Problems and Solutions

Sites not removed from the Control Panel
Web server running, but the site only displays a blank page (not an error page)
Domain and DNS Problems
HTTP Error Codes
Incorrect Web Site Being Displayed

eApps Support Guidelines
Links to other information



Checking the status of the web server

There are two ways to tell if the web server is running - from the Control Panel, and from the command line.

Checking the web server status

Control Panel

To check the web server status from the Control Panel, go to the Site Tab (it does not matter which site you choose, as long as it is on the same VPS where you suspect that the web server is down), Website Settings.

Scroll down to the Status section - if the web server is running, both Web Server and Website will show green.


Web server running

Server Running


If the web server is stopped, both will show red, and the Web Server will say Stopped.

Web server stopped

Webserver stopped

Command line

To check from the command line, use the service httpd status command.

All examples given from the command line are run as the root user. See the SSH User Guide - http://support.eapps.com/hsp/ssh for more information if necessary.

This shows that the web server is running:

[root@eapps-example ~]# service httpd status
httpd (pid 31947 28385 18159 16027 7433 7430) is running...
[root@eapps-example ~]#

This shows that the web server is stopped:

[root@eapps-example ~]# service httpd status
httpd is stopped
[root@eapps-example ~]#

You may also see httpd dead but PID file exists or httpd dead but subsys locked messages. Generally, anything other than httpd running means that the web server is stopped.

Restarting the web server

If the web server is stopped, first try to restart it. A process may have become locked up, and a simple restart may solve the problem without further troubleshooting. This can be done from either the Control Panel or the command line.

Control Panel

To restart the web server from the Control Panel, go to the Site Tab (it does not matter which site you choose, as long as it is on the same VPS where you see that the web server is down), Website Settings.
In the General Settings tab, in the Actions section,  is a Start Website button  Start Website
Click that once. If the web server restarts successfully, you will see that the Web Server and Website are now both green in the Status section.


If the web server does not start, you will get an error similar to this just below the tabs:
An error occurred when starting the server. Refer to the error log for details.

and the Web Server and Website will show as red under Status.


If you try to restart the web server from the System Tab, Web Server - Restart, the error will look similar to this:

Technical Problem occurred
Problem ID p2009-01-15_13-54-22 (this is the date and time of the error)
What Can I Do?
Contact Technical Support Team

Copy and paste the error message or the Problem ID into a support ticket, and send that to eApps support. We can look in the log files for the Control Panel to find the error message and then either resolve the problem, or give you instructions on what you need to do to resolve the issue yourself.

Command line

To start the web server from the command line, use the service httpd start command.

All examples given from the command line are run as the root user. See the SSH User Guide - http://support.eapps.com/hsp/ssh for more information if necessary.

[root@eapps-example ]# service httpd start
Starting httpd:                              [  OK  ]
[root@eapps-example ]#

Depending on various configuration issues, you may see more than just the one line with [OK], but as long as there is an [OK] then the web server is running. You can verify this with the service httpd status command.

If you receive a [FAILED], then the web server did not start.

[root@eapps-example ]# service httpd start
Starting httpd:
                                           [FAILED]
[root@eapps-example ]#

If the web server doesn't print a message to standard output, then look at the Apache error log located at /var/log/httpd/error_log for more information. Also look at the other log files in /var/log/httpd that have the current date and time - further errors may be logged there that will help troubleshoot.

If this doesn't provide you with enough information to resolve the issue, please send a ticket to eApps support with the exact error message and how to replicate your problem. If you have made any recent changes, such as adding or removing sites, or adding or removing applications, please let us know.


Common Web Server Problems and Solutions

Because of the complexity of the Apache web server, and the nearly infinite way that web sites can be programmed/configured/created, it is impossible to provide any type of comprehensive troubleshooting guide. eApps Support will be glad to assist you in resolving any issues you may encounter, as long as you are within our Support Guidelines and understand that our responsibility is the web server as installed, and not your web site.

Sites not removed from the Control Panel

A very common problem that causes the web server to not start is because a site was removed incorrectly. All sites have to be removed from the Control Panel, Site Tab for that site, Website Settings, Delete. This is the only way to remove a site. This method removes the virtual host entries in the httpd.conf file, so that Apache no longer looks for that site when starting.

If the site is removed by just removing the site directory (either with the File Manager or from the command line), Apache will fail the next time it restarts (which could be days or weeks or months later) because the DocumentRoot for that site no longer exists in the file system, but still exists in the httpd.conf file.

There isn't a way to tell from the Control Panel if this is the issue, unless you know that you did remove a site incorrectly. From the command line, trying to start or restart the web server will give an error similar to this:

[root@eapps-example ]# service httpd start
Starting httpd: Warning: DocumentRoot [/home/webadmin/eapps-example.com/html] does not exist
                                           [FAILED]
[root@eapps-example ]#

This error message means exactly what it says - as Apache was reading the httpd.conf file upon start up, it was not able to find the /home/webadmin/eapps-example.com/html directory. Since it could not find that directory, the start up failed. This means that your web server is stopped, and all your sites are down.

To fix this error, go to the Control Panel, Site tab for the site (or sites, as the case may be) that was removed incorrectly, click on Website Settings, and in the General Tab, scroll down and click on Configure, and then immediately click Update.

This adds the default site files back to the file system, and now Apache will start. Then, you can remove the sites the correct way, by using the Delete button.

Web server running, but the site only displays a blank page (not an error page)

This error is usually caused by some type of site misconfiguration. The site error logs, which are found either in the Website Statistics link for that site in the Control Panel or in the site directory from the command line (usually something similar to /home/webadmin/eapps-example.com/error_log) will usually contain valuable information as to the problem.

Remember that the functionality of your site is your responsibility. eApps support will assist you in every way we can, but the ultimate responsibility for the site belongs to you.

PHP Short Tags

A common cause of the site displaying a blank page is if you are using PHP code that uses short_open_tags, but the version of PHP on your VPS does not allow them. This is most common when using code written for PHP4 on a VPS that has PHP5 installed.

A PHP short tag is where the PHP script starts with <? instead of the correct <?php . Short tags were allowed in PHP4 (but discouraged), but are not allowed by default in PHP5. If your code has short tags and your VPS has PHP5 installed, then a blank page will display (not an error page).

There are two ways to resolve this. One way is to replace all the PHP short tags with the correct PHP syntax. Depending on how many files you have to change, this may not be the easiest option. The other way to resolve this is to make a change to the php.ini file to allow short_open_tags.

To change php.ini, you can either use the File Manager in the Control Panel, or edit php.ini from the command line. In either case, you will need to restart the web server for the changes to take effect.

To change php.ini from the Control Panel, go to the System Tab for that VPS, then click on File Manager. In File Manager, navigate to etc > php.ini (not the php.d directory). Check the box  to the left of php.ini, and then click on the Edit link. This opens the php.ini file for editing. This is a large file, so use your browsers search function to find this line:

short_open_tag = Off

Change the Off to an On, and click OK to save the file. Once you have done this , restart the web server for the change to take effect.

To change php.ini from the command line, you will need to edit the php.ini file using the vi editor, and make the same change.

[root@eapps-example ~]# cd /etc
[root@eapps-example etc]# ll php.ini
-rw-r--r-- 1 root root 45003 Dec 11  2007 php.ini
[root@eapps-example etc]# cp php.ini{,.bck}
[root@eapps-example etc]# vi php.ini

Using the vi editor, change the value of the short_open_tag from Off to On. Note the warning about making this change:

; Allow the <? tag.  Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.

Change:

short_open_tag = Off

to:

short_open_tag = On

and save and exit the file. Restart the web server so that the changes can take effect.

MaxClients

Another common problem is when the site displays a blank page (not an error page) or takes a long time to load. This is often caused by the web server reaching its MaxClients setting. See the Apache Performance Tuning User Guide -http://support.eapps.com/hsp/tuning  for more information about MaxClients and how to raise the MaxClients limit. 

If the web server is hitting the MaxClients limit, you will usually see entries similar to this in the Apache error_log located at /var/log/httpd/error_log (note that the absence of these entries doesn't mean that your web server isn't hitting MaxClients, only that it may not be logging these errors)

[Wed Aug 05 14:13:59 2009][error]server reached MaxClients setting, consider raising the MaxClients setting
[Fri Aug 07 11:50:32 2009][error]server reached MaxClients setting, consider raising the MaxClients setting
[Mon Jul 20 15:52:50 2009][error]server reached MaxClients setting, consider raising the MaxClients setting
[Sat Jul 18 09:31:56 2009][error]server reached MaxClients setting, consider raising the MaxClients setting


Another way to see if your web server is hitting the MaxClients limit is to see if the number of httpd connections exceeds your MaxClients value in httpd.conf.

[root@eapps-example ~]# ps -ef | grep -c httpd
13
[root@eapps-example ~]#

If the number returned by the ps -ef command is greater than MaxClients, then the MaxClients limit is being exceeded. You will need to increase MaxClients and restart the web server.

If you are consistently hitting MaxClients, even after increasing the value, then you need to consider upgrading to a larger plan that has more memory so that you can increase the MaxClients value even further.

Web server running, but the site displays an error page (not a 404 type error)

This can occur for many reasons, and the actual error displayed will vary depending on the browser you are using. In most cases the error message displayed by the browser will give you a good indication as to what the actual problem is.

Domain and DNS Problems

One reason for a site giving an error message is that the domain has expired. Depending on how long ago the domain expired, you may get the domain registrars parked page, or an error saying the domain cannot be found.

There are various tools to use to check the status of a domain, such as Domain Tools - http://www.domaintools.com/. This service will let you check the Whois information for a domain, which will show the domain's expiration date, or if the domain is available.

Some registrars automatically add a year to the Expiration date of a domain once it has expired, so that the owner has a chance to register it again before someone else can obtain it. If you are not sure of the domain expiration date, contact your domain registrar for clarification.

The Domain Tools site also has a DNS tools section that is useful for troubleshooting.

Another reason for a site giving an error message is that there is a DNS problem and the site cannot be reached. This is more common with sites that do not use eApps DNS. The User Guide - Managing DNS and Domains - http://support.eapps.com/hsp/dns has a section on DNS troubleshooting that may be useful.

If you cannot access your site, but you can access other sites, run a traceroute or MTR from your location to your VPS. There may be a network or routing issue between your location and the eApps network that could be causing problems.

Information on running a traceroute on Windows can be found here - http://support.microsoft.com/kb/162326. Information on running a traceroute from Mac OS X is found here - http://ss64.com/osx/traceroute.html.

MTR is basically a combination of ping and traceroute, and will often complete where a traceroute fails. MTR also provides better diagnostic information than traceroute. If possible, use MTR instead of traceroute.  MTR for Windows can be found here - https://sourceforge.net/projects/winmtr/, and MTR for Mac OS X is here - http://mtr.darwinports.com/. Linux/*BSD users may already have MTR installed - if not, it can be installed using the application manager for your specific Linux distro or BSD flavor.


A useful tool to see if the problem is with your site, or with the DNS or routing to your site, is Down For Everyone Or Just Me - http://downforeveryoneorjustme.com/. This will let you know if the site is up, but just not accessible by you.

If you are unable to get to the eApps main site, or the Support Site, our firewall may be blocking your IP address. In order for support to be able to check that, we will need your public IP address, which can be found here - http://whatismyip.com. Copy and paste that into an e-mail, and send it to eApps Support.


HTTP Error Codes

Web server running, but the site displays an HTTP Status Code

There are over 50 HTTP Status Codes, ranging from the familiar 404 (Resource not found) to the humorous 418 (I'm a teapot - as defined in the April Fool's RFC 2324). Wikipedia has a full list - http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

The status code returned by the web server will generally tell you exactly what the problem is, although the message may be a bit terse. For more information, look in the error_log for both the site and the web server. The log files will usually give you a starting point to begin troubleshooting.


Due to the large number of status codes, and the complexity of the Apache web server, it is not possible to provide much information regarding the various status codes. There is extensive online documentation on the status codes, as well as general Apache troubleshooting.

However, one error code that may be useful to know is the 503 error: 503 Service Unavailable - if your site is running Tomcat/JBoss/GlassFish/Liferay/Ruby or any other application server, this error means that the application server needs to be restarted.

Incorrect Web Site Being Displayed

Web server running, but the site displays the wrong page

This is most common when trying to go to http://www.eapps-example.com, but instead you get another site that you host on your VPS. If you go to just http://eapps-example.com, then the correct site comes up.

This is caused by the 'www' alias not being checked in the Site Tab. To correct this, go to the Site tab for that site, Website Settings, and then click Configure. The very first listing is for Website, and there will be a checkbox for 'www' that is not checked.

www Checkbox

 Check that box, then click Update. You may need to wait around 5 minutes for the change to fully take effect.



eApps Support Guidelines

eApps Web Hosting is responsible for the Apache Web Server as installed in your VPS. It is our responsibility to ensure that Apache is installed correctly, and that the default Welcome Page shows correctly in a browser. We use a standard install of the latest version of the Apache server that was available to us from Parallels when the VPS was created. If you are using PHP for your sites, it is our responsibility to ensure that PHP is installed correctly and functioning.

eApps Web Hosting is not responsible for your sites, or the content of your sites, or the functionality of your sites. If the Apache Web Server is running, and the default Welcome Page shows for a new or default site, then that is technically the extent of our responsibilities.

If your sites have mission or business critical data or configurations, it is your responsibility to make sure that the content for the sites is safely backed up. Do not rely on eApps to have current copies of your data or files.

Any server modifications, such as htaccess files or mod_rewrite directives, are outside of our support boundaries. It is assumed that if you are making these types of modifications to your web site that you are familiar with the setup, configuration, and troubleshooting for these types of modifications, or that you know where to search to find the answers. Any assistance with server customizations such as htaccess files or mod_rewrite, or any assistance troubleshooting your site content or functionality could be considered billable support, at our standard rate of $15 per 10 minute increment.

If you make manual changes to httpd.conf, or add modules or make any other configurations changes to the web server, be aware that any support needed to correct problems caused by these modifications will be billable, at our standard rate of $15 per 10 minutes.

If you have made manual, unsupported changes to httpd.conf or to any other part of the web server and are requesting eApps Support assistance, please let us know, as this could save valuable time troubleshooting the problem.

The general assumption, if you are making unsupported changes to httpd.conf or to the web server, is that you are an expert in Apache web server configuration, and will not require any support assistance from eApps if you encounter any problems.

All changes to the virtual host blocks in httpd.conf must be done from the Control Panel. If you manually edit the virtual hosts in httpd.conf, the Control Panel will overwrite your changes, and your sites may stop functioning. This is a feature, not a bug, and this behavior cannot be changed.

As always, eApps support will go the extra mile to assist you with any problems you may have with your websites, but with the understanding that the content and functionality of your sites is ultimately your responsibility.

Links to other information

Apache Web Server Documentation - http://httpd.apache.org/docs
Megaproxy - https://www.megaproxy.com/freesurf/ - similar to Down For Everyone Or Just Me
MTR (a better tool than traceroute or ping by themselves) - http://www.bitwizard.nl/mtr/
Apache Logging (unsupported, but may be useful) - http://www.linux.com/archive/feature/124161
Red Hat Apache Server Documentation (CentOS is based on Red Hat Enterprise Linux) - http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.5/html/Deployment_Guide/ch-httpd.html

Comments

Please login to comment