Just like 90% of the home maintenance work can be done with a screwdriver and a wrench, the Web server is no exception. Let's take a look at these tools.
1, the server response is slow
If the server responds slowly, the first thing to do is to judge whether the problem comes from the server or the network, and the first tool is uptime.
Uptime displays the average load on the server, and if the last number is above 2 or 3, the problem is that some processes are taking up too much of the system's resources. If the number is not very high, you need to consider the network factor.
If you see a high load, you need to use the top command to determine which processes are consuming system resources.
The top command displays 10 processes by default, and of course you can use top N to specify the number of processes you need to view.
A more detailed list of processes can use the PS-AUXW command
Compare the "hard" limits of the WEB process (the Apache compile-time limit) and the "soft" limit (httpd.conf limit), and if the numbers are close, consider upgrading your hardware or recompiling Apache.
2, not authorized to sign in
If you are concerned about illegal users breaking into the system, the easiest way is to use the W command to check.
If you really see an illegal user on your system, you can kill his process immediately, use the VIPW command to change his password to "*", or change the shell to/sbin/nologin.
3, the service can not start or crash
If the WEB server does not start or crashes at startup, you will need to use the APACHECTL command to find the cause. First check the legality of httpd.conf with Apachectl configtest command. But Apachectl is not a panacea. If the problem is still unresolved, we should check the error log. In addition, Apachectl checks the/var/run/httpd.pid file to find the original process, and if the process number is different, the Apachectl Stop command does not work. In this case, you need to use the PS command to kill the corresponding process.
4, network detection
To find out what caused the network problem, the first simple command is ping.
If the ping results look normal, you may need to use a larger package to try, Ping's default packet size is 56 bytes, we use-s to specify the package size of 2048 bytes to try. After a large package, the return time is very normal, but a very long time to return or packet loss will show the network has a problem.
5. Cross Signal
If you suspect that there is a problem with the network configuration between the server and the switch, you can use the Netstat-finet command to display the open ports and the external services for the machine.
If you care if your server is compromised, you will see that the kernel's memory usage is exceptional and can be used
Netstat-m parameter to view.
If you find that the httpd load is not heavy, but the memory of network resources is still very large, you can consider shutting down some services and ports.
6, network problems
If there is a problem with the network, you will need to use the Ifconfig command to check that the NIC is normal. This command will display the IP address, mask, duplex, speed, etc. of the network card.
A common problem is the network card speed or duplex setting and switch port inconsistencies. In particular, the "autosense" option was set, but it did not succeed. can be used
Ifconfig down eth0 [options]
To close.
7, Permission issues
There are some bizarre problems that may well come from no space left. The DF command can be used to check the remaining hard disk space. A simple example is that the PHP session is invalid because the file system/TMP written to session is full.
Some problems are not set permissions, the common problem is that the CGI script has not been set X permissions, does not set the RX permissions for some directories.
8, the common suspect object
If a problem occurs, the first thing should be to check the system log:/var/log/messages.
If you cannot find some log files in the/var/log/directory, you can view the configuration of the/etc/syslog.conf.
For Apache, you need to check [Apache_dir]/logs/error _log to determine why it cannot be started.
The above is the author to deal with the Web server emergency measures of some personal experience, if you have good experience, the author warmly welcome your communication.
please contact the site, timely note your name. Contact Email: edu#chinaz.com (change # to @).