Apache Server Troubleshooting Tips

Source: Internet
Author: User
Tags mail exchange

Apache Server Troubleshooting Raiders application Server Apache browser configuration Management Network application with the popularization of network technology, application and the continuous improvement of web technology, Web Service has become one of the important service forms on the Internet. The original client/server model is gradually being replaced by the browser/server model. This article will focus on the troubleshooting tips for Apache servers. Http://www.poluoluo.com/jzxy/200809/45669.html

One, check the configuration file error

The Apache server settings file is located in the/etc/httpd/conf/directory, traditionally using three profiles httpd.conf,access.conf and srm.conf to configure Apache server behavior. In the new version of Apache, all the settings are placed in the httpd.conf, so only the settings in this file need to be adjusted. Where the 99% Apache server error is a misconfigured configuration file.

1 using the Apachectl configtest command

If the configuration file has errors, you can use the Apachectl configtest command, and the Apachectl configtest command can check out all syntax and logic errors.
& #61548;
Example 1
Here is a sample configuration file snippet:

<Location/server-status>
SetHandler Server-status
Order Deny,allow
Deny from all
Allow from 192.168.149.
</Location>
If the black part of the error is written "<location/server-status" less write a >. The Apachectl configtest command checks for this problem, and the output is as follows:
Apachectl Configtest
Syntax error on line 918 of/etc/httpd/conf/httpd.conf:
<Location> directive missing closing ' > '
2 Using the Service Management tool

If the configuration file has errors, you can also use the GUI tool to view it. The following is the embodiment of instance 1 in the GUI tool "service Configuration", 1.

Figure 1 using GUI tools to check for errors
Second, learn to use the error log

The error log is the most important log file, and its file name and location depend on the errorlog directive. Apache HTTPD will store the diagnostic information in this file and handle the errors in the request, since it often contains error details and how to resolve it, if the server is up or running, you should first check the error log. The error log is your friend. Any error will be recorded in the error log, so you should check it first. If your web space provider does not allow access to the error log, you should consider changing a space provider. Learn to read the error log to quickly identify problems and resolve them quickly.

1 Error log format

Apache default error log configuration is as follows:
Errorlog Logs/error_log
LogLevel warn
The configuration error log is relatively simple, as long as the log file storage path and logging level can be described. The format is:
Date and time error level error message

2 logging levels

The following is an emphasis on logging levels, including eight levels.
Level 1 English name Emerg, emergency situation makes the system unavailable, such as system downtime, etc.
Level 2 Alert English name, situations requiring immediate attention
Level 3 English name crit, warning of dangerous situations
Level 4 English name error, except Emerg, alert, crit other errors
Level 5 English name warn. Warning message
Level 6 English name notice, need to draw attention to the situation, but not as error, warn important
Level 7 English Name info, a general message worth reporting
Level 8 English Name debug, the message generated by the program running in debug mode

Examples of error log files

The error log format is relatively flexible and can be appended with a text description. Some of the information appears in the vast majority of records, a typical example being:
[Wed Oct 11 14:32:52 2007] [ERROR] [Client 127.0.0.1] client denied by server configuration:/export/home/live/ap/htdocs/test
The first item is the date and time when the error occurred, the second is the severity of the error, the loglevel instruction makes only errors higher than the specified severity level are logged, the third is the IP address that caused the error, and thereafter the information itself, in this case, the server rejects the client's access. The server uses the file system path instead of the Web path when it logs the file being accessed. The error log contains multiple types of information similar to the example above. In addition, any information that is output to stderr in a CGI script is recorded as debug information in the error log intact. The user can add or remove entries for the error log. However, for some special requests, there will be a corresponding record in the access log, such as the above example in the access log will also have a corresponding record, its status code is 403, because the access log can also be customized, so you can get more information about the error event from the Access log.
4 checking Apache Server module issues

If the Apache server can be started, but some features cannot be implemented, such as the WebDAV feature described earlier, usually the module that provides this functionality is not loaded, you can use the command: "Httpd-m" to see the module load.

It will output a list of modules that have been enabled, including statically compiled modules in the server and modules that are dynamically loaded as DSO. You can also access http://192.168.1.12/server-info/?list using a browser to get 2.


Figure 2 Module loading situation

5 View information about Apache 2.x released by Red Hat

Follow the steps below to see some information about the Apache 2.2.3 published by Red Hat.

(1) View compilation configuration parameters
Using the Httpd-v command,
Httpd-v
Server version:apache/2.2.3
Server Built:nov 29 2006 06:33:19
Server ' s Module Magic number:20051115:3
Server loaded:apr 1.2.7, Apr-util 1.2.7
Compiled using:apr 1.2.7, Apr-util 1.2.7
Architecture:32-bit
Server Mpm:prefork
Threaded:no
Forked:yes (variable process count)
Server compiled with ....
-D apache_mpm_dir= "Server/mpm/prefork"
-D Apr_has_sendfile
-D Apr_has_mmap
-D Apr_have_ipv6 (ipv4-mapped addresses enabled)
-D Apr_use_sysvsem_serialize
-D Apr_use_pthread_serialize
-D single_listen_unserialized_accept
-D Apr_has_other_child
-D Ap_have_reliable_piped_logs
-D dynamic_module_limit=128
-D httpd_root= "/ETC/HTTPD"
-D suexec_bin= "/usr/sbin/suexec"
-D default_pidlog= "Logs/httpd.pid"
-D default_scoreboard= "Logs/apache_runtime_status"
-D default_lockfile= "Logs/accept.lock"
-D default_errorlog= "Logs/error_log"
-D ap_types_config_file= "Conf/mime.types"
-D server_config_file= "conf/httpd.conf"
From the output above you can learn about the Apache server version and the compiled parameters.
(2) View the modules that have been compiled

Using the Httpd-l command,
Httpd-l
Compiled in Modules:
Core.c
Prefork.c
Http_core.c
Mod_so.c
Description: The compiled module contains MOD_SO.C, which indicates that the current Apache supports dynamic Shared Objects (DSO), that is, users can use Apache without recompiling Apache EXtenSion (APXS) compiles the Apache third-party module. The compiled module contains PREFORK.C that the Apache published by Red Hat is running using the pre-derived (profork) MPM mode.


Three steps to troubleshoot Apache server

1 Check the error log!

The Apache server will do its best to help you when you encounter problems. In many cases, it provides some detail by writing one or more messages in the error log. Sometimes this is enough for you to diagnose and solve problems yourself (such as file permissions or similar problems). The default location of the error log is/usr/local/apache2/logs/error_log, but finally look at the errorlog directive in the configuration file to confirm the exact location of the error log on your server.

2 Check grammar again

The Apache configuration file is httpd.conf length usually in 80-990 rows, and almost 99%apache faults are caused by grammatical errors. You can manually check the/etc/httpd/conf/httpd.conf, or you can enter it via the browser: Http://192.168.1.12/server-info?config gets the current profile, 3.

Figure 3 Current Apache server configuration file
Note: Line numbers are added automatically at this time.

3 See Apache's faq!

The latest version of the Apache FAQ list is always available from the Apache primary site, http://httpd.apache.org/docs/2.2/faq/.

4 View Apache Bug Database

Most of the issues reported to the Apache project team are recorded in the bug database. Before you add a new bug, be sure to check the existing reports (open and closed). If you find that your problem has been reported, please do not add a report like "I also". If the original report has not been closed, we recommend that you periodically look at it regularly. You may also consider contacting the original submitter, as there may be problems in the mail exchange that are not recorded in the database.

5 Ask a question in a user forum

Apache has an active community of users who are willing to share knowledge. Participating in this community is often the quickest and best way to get answers.
Apache User Mailing list: http://httpd.apache.org/userslist.html

6 Submit a problem report to the bug database

If you have done these steps without getting answers, be sure to let HTTPd's developers know about the problem and submit a bug report here (http://httpd.apache.org/bug_report.html).

7 Get Business Support

You can obtain the technical support of the commercial website service provider from the following URL: http://www.apache.org/info/support.cgi

8 documentation about the network resources of the Apache server

Apache server is the most widely used Web server, it has many versions. A number of useful tips can be obtained from the following network resources to help you quickly resolve failures and build Web services.
Generic Apache Document: http://httpd.apache.org/docs-2.0
Apache faq:http://www.apache.org/foundation/faq.html
1.3 Version Faq:http://httpd.apache.org/docs/misc/faq.html
Mailing list: http://httpd.apache.org/userslist.html

Apache Server Troubleshooting Tips

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.