{"id":3735,"date":"2012-12-19T13:39:33","date_gmt":"2012-12-19T05:39:33","guid":{"rendered":"https:\/\/www.icocean.com\/wp\/?p=3735"},"modified":"2012-12-19T17:08:05","modified_gmt":"2012-12-19T09:08:05","slug":"apache-performance-tunning","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=3735","title":{"rendered":"Apache Performance Tunning"},"content":{"rendered":"<p>1.\u91cd\u8981\u7684\u5c31\u662fRAM\uff0c\u5bf9\u5e94\u5230\u53c2\u6570\u8bbe\u7f6e\uff0c\u5c31\u662f\u8981\u8bbe\u7f6e\u5408\u7406\u7684Maxclients\u503c\uff0c\u907f\u514d\u8fdb\u7a0b\u8fd0\u884c\u5728swap\u91cc\u3002<\/p>\n<p>2.HostnameLookups \u8981\u8bbe\u7f6e\u4e3aOff\uff0c\u907f\u514d\u5904\u7406\u6bcf\u6b21\u8bf7\u6c42\u524d\u8fd8\u8981\u67e5\u8be2dns<\/p>\n<p>3.\u907f\u514d\u4f7f\u7528SymLinksIfOwnerMatch\uff0c\u5373\u9664\u975e\u5fc5\u8981\uff0c\u4e00\u822c\u6700\u597d\u5168\u90e8\u8bbe\u7f6e\u6210FollowSumLinks<br \/>\n<Directory \/><br \/>\nOptions FollowSymLinks<br \/>\n<\/Directory><\/p>\n<p>4.\u907f\u514d\u4f7f\u7528AllowOverride\uff0c\u5373\u9664\u975e\u5fc5\u8981\uff0c\u5219\u6700\u597d\u5168\u90e8\u8bbe\u7f6e\u4e3aNone<!--more--><br \/>\n<Directory \/><br \/>\nAllowOverride None<br \/>\n<\/Directory> <\/p>\n<p>\u4e3e\u4f8b\uff0c\u5982\u679c\u914d\u7f6e\u6210\u4e0b\u9762\u7684<br \/>\nDocumentRoot \/www\/htdocs<br \/>\n<Directory \/><br \/>\nAllowOverride all<br \/>\n<\/Directory><\/p>\n<p>\u5219\u5f53\u8bbf\u95eeURI \/index.html\u65f6\uff0cApache\u5c06\u4f1a\u8bd5\u56fe\u8bbf\u95ee \/.htaccess, \/www\/.htaccess, \u548c \/www\/htdocs\/.htaccess\uff0c\u8017\u8d39\u65f6\u95f4\u554a\u3002<\/p>\n<p>5.\u660e\u786eDirectoryIndex<br \/>\n\u5373\u907f\u514d\u4f7f\u7528DirectoryIndex index<br \/>\n\u800c\u5e94\u4f7f\u7528DirectoryIndex index.htm index.html index.shtml index.php<\/p>\n<p>6.MinSpareServers, MaxSpareServers, \u548c StartServers<br \/>\n\u81eaApache1.3\u540e\uff0c\u4eceStartServers\u5f00\u59cb\uff0c\u6700\u5f00\u59cb\u6bcf\u79d2\u53ef\u65b0\u5efa\u4e00\u4e2achild process\uff0c\u7b49\u4e00\u79d2\uff0c\u65b0\u5efa2\u4e2a\uff0c\u7b491\u79d2\uff0c\u65b0\u5efa4\u4e2a\uff0c\u6bcf\u79d2\u53ef\u65b0\u5efa\u7684child\u6570\u6210\u500d\u589e\u957f\uff0c\u76f4\u81f3\u6700\u592732\u4e2a\u6bcf\u79d2\u3002\u5f53\u7136\u4f1a\u88ab\u9650\u5b9a\u5728MinSpareServers\u4ee5\u5185\u3002<br \/>\n\u5f53\u6bcf\u79d2\u65b0\u5efa\u7684child\u5927\u4e8e\u7b49\u4e8e4\u4e2a\u65f6\uff0c\u5c31\u4f1a\u5728apache error log\u4e2d\u4ea7\u751f\u4e00\u6761\u8bb0\u5f55\uff1b\u5982\u679c\u4f60\u770b\u5230\u4e86\u8fd9\u6837\u7684\u4e00\u6761\u8bb0\u5f55\uff0c\u5219\u8bf4\u660e\u4f60\u9700\u8981\u8003\u8651\u8c03\u6574\u8fd9\u51e0\u9879\u8bbe\u7f6e\u4e86\u3002<\/p>\n<p>7.MPM\u7684\u9009\u62e9<br \/>\nWorker MPM\uff1a\u6709\u591a\u4e2achild\u8fdb\u7a0b\uff0c\u6bcf\u4e2a\u8fdb\u7a0b\u53c8\u53ef\u4ea7\u751f\u591a\u4e2athread(\u7ebf\u7a0b),\u6bcf\u4e2a\u7ebf\u7a0b\u5904\u7406\u4e00\u4e2a\u8fde\u63a5\u3002\u5728\u9ad8\u8d1f\u8f7d\u7684web server\u4e0a\uff0c\u5b83\u7684\u6027\u80fd\u66f4\u597d\uff0c\u76f8\u5bf9\u6d88\u8017\u7684\u5185\u5b58\u8f83Prefork\u8981\u5c11\u3002<br \/>\nPrefork MPM\uff1a\u6709\u591a\u4e2achild\u8fdb\u7a0b\uff0c\u6bcf\u4e2a\u8fdb\u7a0b\u53ea\u6709\u4e00\u4e2athread(\u7ebf\u7a0b),\u6bcf\u4e2a\u8fdb\u7a0b\u5904\u7406\u4e00\u4e2a\u8fde\u63a5\u3002\u5728\u4e0e\u975e\u7ebf\u7a0b\u5b89\u5168\u7684\u6a21\u5757\u4e00\u8d77\u5de5\u4f5c\u65f6\uff0cPrefork\u5177\u6709\u66f4\u597d\u7684\u7a33\u5b9a\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u91cd\u8981\u7684\u5c31\u662fRAM\uff0c\u5bf9\u5e94\u5230\u53c2\u6570\u8bbe\u7f6e\uff0c\u5c31\u662f\u8981\u8bbe\u7f6e\u5408\u7406\u7684Maxclients\u503c\uff0c\u907f\u514d\u8fdb\u7a0b\u8fd0\u884c\u5728swap\u91cc\u3002 2. <a href='https:\/\/www.icocean.com\/blog\/?p=3735' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[638,3704,392,1881],"class_list":["post-3735","post","type-post","status-publish","format-standard","hentry","category-lamp","tag-apache","tag-performance","tag-392","tag-1881","category-24-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3735"}],"version-history":[{"count":5,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3735\/revisions"}],"predecessor-version":[{"id":3740,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3735\/revisions\/3740"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}