Home  >  Article  >  Backend Development  >  Apache performance optimization tips_PHP tutorial

Apache performance optimization tips_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:29:24898browse

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.
Set "HostNameLookups off" in httpd.conf to avoid reverse lookups of each visitor's DNS 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.
Default guarantee Your web pages and CGI pages use browser caching technology. For specific articles, please refer to this site: Use mod_gzip to speed up Zope and Apache
Keep your Apache slim, compile those modules that are only needed, modify the srcDownloadFilesConfiguration file before compiling, and comment out the unnecessary modules with a # sign .
If you do not need traffic logs, then point the TransferLog in httpd.conf to /dev/null/
Unless you are sure to use .htaccess files to control the permissions of some directories, set "AllowOverride None" so that Save Apache the labor of searching for .htaccess files in every directory.
Don’t let unnecessary background processes run.
Never write pages or log files to network disks, 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 CGI scripts:
File I/O: The fewer open files the better.
Shell command: Use the full path to call the shell command.
If your site 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 you will spend on positioning.


The fewer images on the web server, the better, and make sure every image is run through an image compressor.
To do 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 will be very safe and the load will immediately drop to 0, :-)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531704.htmlTechArticleThis 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. In httpd.conf...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn