Several practical tips for optimizing Apache
Author:Eve Cole
Update Time:2009-06-04 17:12:35
This article briefly introduces several tips for optimizing Apache, which are very useful in actual combat.
Upgrade Apache to the latest version, which often contains performance improvements and security updates.
Setting "HostNameLookups off" in httpd.conf can avoid reverse lookups of each visitor's DNS domain name.
For busy sites, set "MaxClients 230" or higher in httpd.conf. This setting allows more httpd processes to respond to requests simultaneously and avoids processor queuing.
Use another server to process image files.
There is no warranty that your Web pages and CGI pages use browser caching technology. For specific articles, please refer to this site: Using mod_gzip to accelerate Zope and Apache
To keep your Apache slim, compile only the modules you need. Before compiling, modify the src/Configuration file and comment out the modules you don't need with a # sign before them.
If traffic logs are not required, point TransferLog in httpd.conf to /dev/null/
Unless you are sure to use .htaccess files to control permissions on some directories, set "AllowOverride None" to avoid the labor of Apache searching for .htaccess files in each directory.
Don't let unnecessary background processes run.
Never write pages or log files to a network disk, such as NFS.
Do not run Apache (httpd) in inetd mode.
Don't let X Windows run on your Web server, use Ctrl-Alt-Backspace to turn off X.
Avoid using SSI tags.
In a CGI script:
File I/O: The fewer open files the better.
Shell command: Use the full path to call the shell command.
If your website is primarily CGI driven, use mod_perl.
In your Web page directory, do not let the number of files exceed 1,000. The more files you have, the more time it will take to locate them.
The fewer images on the web server, the better, and make sure every image is run through an image compressor.
To perform a stress test on your website, it is recommended to use the ab command that comes with Apache to test.
For the best performance, it is best to unplug the network cable, so that your web server is very safe and the load is immediately reduced to 0, :-)