{"id":318,"date":"2017-02-03T18:35:37","date_gmt":"2017-02-03T10:35:37","guid":{"rendered":"http:\/\/www.rainweb.site\/?p=318"},"modified":"2017-02-03T18:35:37","modified_gmt":"2017-02-03T10:35:37","slug":"apache-article0013","status":"publish","type":"post","link":"http:\/\/rain1024.com\/index.php\/2017\/02\/03\/apache-article0013\/","title":{"rendered":"\u5173\u4e8eDebian\u7cfb\u7edf\u4e2dApache\u5185\u5b58\u5360\u7528\u592a\u9ad8\u7684\u5982\u4f55\u4f18\u5316"},"content":{"rendered":"<h4>\u8fd9\u662f\u4e3adebian\u7cfb\u7edf\u5199\u7684\uff0ccentos\u548cubuntu\u53ef\u4ee5\u53bb\u7f51\u4e0a\u770b\u66f4\u597d\u7684\u6587\u7ae0\u3002<\/h4>\n<h5>\u5982\u9898\uff0c\u8bb0\u5f55\u4eca\u5929\u5927\u6218apache\u7684\u7ecf\u8fc7\uff0c\u5728\u5e03\u7f6e\u597d\u670d\u52a1\u5668\u4ee5\u540e\uff0c\u7f51\u6613\u8702\u5de2\u7ecf\u5e38\u63d0\u9192\u6211\u670d\u52a1\u8fc7\u8f7d\uff0c\u5185\u5b58\u6d88\u8017\u592a\u5927\uff0c\u7ecf\u5e38\u5c31\u662f70%--90%\u5de6\u53f3\uff0c\u6211\u53ea\u662f\u505a\u4e2a\u535a\u5ba2\u800c\u5df2\uff0c\u600e\u4e48\u4f1a\u6d88\u8017\u8fd9\u4e48\u5927\uff0c\u4e00\u5f00\u59cb\u6211\u4e5f\u6ca1\u6709\u7ba1\uff0c\u56e0\u4e3a\u6211\u4e70\u7684\u670d\u52a1\u5668\u53ea\u6709640MB\u5185\u5b58\uff0c\u4ee5\u4e3a\u662f\u5b89\u88c5\u4e86\u63d2\u4ef6\u7684\u539f\u56e0\uff0c\u628a\u63d2\u4ef6\u4e5f\u505c\u7528\u4e86\uff0c\u4f46\u8fd8\u662f\u6ca1\u6709\u4ec0\u4e48\u6548\u679c\uff0c\u6709\u65f6\u5019\u5c31\u662f\u5199\u4e2a\u6587\u7ae0\u670d\u52a1\u5668\u90fd\u4f1a\u5b95\u673a\u4e86\uff0c\u8fd8\u5f97\u53bb\u8702\u5de2\u624b\u52a8\u91cd\u542f\uff0c\u5f88\u751f\u6c14\u554a\uff0c\u770b\u5e16\u5b50\u91cc\u6709\u5f88\u591a\u662f512MB\u7684\u4e5f\u4e0d\u5361\uff0c\u6211\u7684\u600e\u4e48\u8fd9\u4e48\u5361\uff0c\u76f4\u5230\u4eca\u5929\u518d\u4e5f\u5fcd\u4e0d\u4e86\u4e86\uff0c\u6211\u51b3\u5b9a\u597d\u597d\u8c03\u67e5\u4e00\u4e0b\u539f\u56e0\uff0c\u4f5c\u4e3a\u4e00\u4e2a\u7a0b\u5e8f\u5458\uff0c\u4e0d\u80fd\u88ab\u7a0b\u5e8f\u73a9\u4e86\u554a\u3002\u8fd9\u662f\u6211\u4e00\u5f00\u59cb\u670d\u52a1\u5668\u7684\u622a\u56fe\uff0c\u5df2\u7ecf\u53c8\u5feb\u8981\u5d29\u6e83\u4e86<\/h5>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/47.93.162.35\/wp-content\/uploads\/2017\/02\/235631250.png\" alt=\"\" width=\"560\" height=\"339\" class=\"alignnone size-full wp-image-322\" srcset=\"http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/235631250.png 560w, http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/235631250-300x182.png 300w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/p>\n<h5>\u7136\u540e\u7528\u547d\u4ee4\u67e5\u4e86\u4e00\u4e0b\uff0c\u53d1\u73b0\u679c\u7136\u6d88\u8017\u5f88\u5927<\/h5>\n<pre><code>#free m\n#top\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/47.93.162.35\/wp-content\/uploads\/2017\/02\/235597109.png\" alt=\"\" width=\"796\" height=\"501\" class=\"alignnone size-full wp-image-323\" srcset=\"http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/235597109.png 796w, http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/235597109-300x189.png 300w, http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/235597109-768x483.png 768w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><\/p>\n<h5>\u6ca1\u529e\u6cd5\uff0c\u53ea\u80fd\u5e72\u4e86\uff0c\u4ed4\u7ec6\u770b\uff0cmysql\u5360\u7528\u6700\u591a\uff0c\u4f46\u53ea\u6709\u4e00\u4e2a\uff0c\u800capache\u5f00\u542f\u4e8610\u4e2a\u8fdb\u7a0b\uff0c\u4f46\u662f\u4e5f\u4e0d\u80fd\u8d38\u7136\u7684\u76f4\u63a5\u5173\u6389\u554a\uff0c\u6211\u5c31\u5148\u53bbgoogle\u4e86apache\u5185\u5b58\u5360\u7528\u592a\u9ad8\u600e\u4e48\u529e\uff0c\u679c\u7136\u6709\u7ed3\u679c\uff0c\u8981\u53bbapache\u4e0b\u627e\u5230httpd.conf\u6587\u4ef6\uff0c\u7136\u540e\u4fee\u6539\u51e0\u4e2aapache\u7684\u53c2\u6570\u5c31ok\uff0c\u7136\u800c\u6211\u5728\u6211\u670d\u52a1\u5668\u91cc\u627e\u4e86\u5f88\u4e45\uff0c\u628a\u6240\u6709\u6587\u4ef6\u90fd\u7ffb\u4e86\u4e00\u904d\u4e5f\u6ca1\u6709\u770b\u5230httpd.conf\u8fd9\u4e2a\u6587\u4ef6\uff0c\u5f88\u96be\u8fc7\u554a\uff0c\u518d\u56de\u53bb\u770bgoogle\u6211\u53d1\u73b0\u6587\u7ae0\u5927\u591a\u662fubuntu\u4e0b\u7684apache\uff0c\u96be\u9053\u6211\u7684\u4e0d\u662f\u4e48\uff0c\u597d\u5427\uff0c\u67e5\u4e00\u4e0b\u670d\u52a1\u5668\u7684\u7cfb\u7edf\u5427\uff0c<\/h5>\n<pre><code># head -n 1 \/etc\/issue\n\u7ed3\u679c\uff1a\nDebian GNU\/Linux 7 \\n \\l\n<\/code><\/pre>\n<h5>\u597d\u5427\uff0c\u6211\u7684\u679c\u7136\u4e0d\u662fubuntu\uff0c\u800c\u662fdebian\uff0c\u8fd9\u4e0b\u53ea\u80fd\u518d\u53bbgoogle\u4e00\u4e0bdebian\u7cfb\u7edf\u7684apache\u4e2dhttpd.conf\u5728\u90a3\u91cc\uff0c\u7adf\u7136\u6ca1\u6709\u4e2d\u6587\u7684\uff0c\u7136\u540e\u6211\u6253\u5f00\u4e86\u4e00\u4e2a\u65e5\u6587\u7684\u6587\u7ae0\uff0c\u770b\u4e86\u4e00\u4e0b\u597d\u50cf\u662f\/etc\/apache2\/apache2.conf\u5c31\u662fapache\u7684\u4e3b\u914d\u7f6e\u6587\u4ef6\uff0c\u554a\u554a\u554a\uff0c\u6211\u65e9\u5e94\u8be5\u60f3\u5230\u7684\uff0c\u6253\u5f00\u770b\u4e86\u4e00\u4e0b\uff0c\u53c8\u61f5\u4e86\uff0c\u8fd9ubuntu\u8fd8\u662f\u4e0d\u4e00\u6837\uff0c\u91cc\u9762\u6709\u4e09\u7ec4\u53c2\u6570\uff0c\u6ca1\u770b\u6e05\uff0c\u4e09\u7ec4\u90fd\u6539\u4e86\uff0c\u91cd\u542f\u670d\u52a1\u5668\uff0capache\u76f4\u63a5\u542f\u52a8\u4e0d\u4e86\u4e86\uff0c\u5413\u5230\u6211\u4e86\uff0c\u770b\u4e86\u4e00\u4e0b\u65e5\u5fd7<\/h5>\n<pre><code>apache2:\u00a0apr_sockaddr_info_get()\u00a0failed\u00a0for\u00a0blog-923452-9d04bc01-f63fj\napache2:\u00a0Could\u00a0not\u00a0reliably\u00a0determine\u00a0the\u00a0server's\u00a0fully\u00a0qualified\u00a0domain\u00a0name,\u00a0using\u00a0127.0.0.1\u00a0for\u00a0ServerName\napache2:\u00a0apr_sockaddr_info_get()\u00a0failed\u00a0for\u00a0blog-923452-9d04bc01-f63fj\napache2:\u00a0Could\u00a0not\u00a0reliably\u00a0determine\u00a0the\u00a0server's\u00a0fully\u00a0qualified\u00a0domain\u00a0name,\u00a0using\u00a0127.0.0.1\u00a0for\u00a0ServerName\nRestarting\u00a0web\u00a0server:\u00a0apache2.\n<\/code><\/pre>\n<h5>\u6ca1\u770b\u61c2\uff0c\u7136\u540e\u628a\u4ee5\u524d\u5907\u4efd\u7684apache2.conf\u5b89\u88c5\u4e0a\uff0c\u91cd\u542f\uff0capache\u542f\u52a8\u4e86\uff0c\u770b\u6765\u662f\u6211\u6539\u9519\u4e86\uff0c\u518d\u91cd\u65b0\u6539\u5427\uff0c\u5728\u8fd9\u91cc\u63d0\u9192\u4e00\u4e0b\uff0c<strong>\u505a\u8fd9\u79cd\u4e8b\u60c5\u4e00\u5b9a\u8981\u63d0\u524d\u5907\u4efd\uff0c\u4e0d\u7136\u6539\u9519\u4e86\u5c31\u5b8c\u86cb\u4e86<\/strong>\uff0c\u5c31\u8fd9\u6837\u6211\u8ba4\u771f\u7684\u6539\u4e86\u4e24\u6b21\uff0c\u7ec8\u4e8e\u53d1\u73b0\u53ea\u80fd\u4fee\u6539\u6700\u540e\u4e00\u7ec4\uff0c\u5bf9\u5e94\u7684\u53c2\u6570\u6539\u6210\u8fd9\u6837<\/h5>\n<pre><code>*   StartServers 1\n*   MinSpareServers 1\n*   MaxSpareServers 5\n*   ServerLimit \u00a0 \u00a0 \u00a010\n*   MaxClients\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10\n<\/code><\/pre>\n<h5>\u4e00\u5b9a\u8981\u770b\u597d\u540d\u5b57\uff0c\u53ea\u4fee\u6539\u6700\u540e\u4e00\u7ec4\u7684\u8fd9\u51e0\u4e2a\u53c2\u6570\uff0c\u91cd\u542f\uff0c\u53d1\u73b0\u679c\u7136\u6709\u6548\u679c\uff0c\u628aapache\u542f\u52a8\u7684\u5b50\u8fdb\u7a0b\u6570\u6539\u5c0f\u4e86\u4ee5\u540e\u53ea\u542f\u52a8\u4e86\u51e0\u4e2a\uff0c\u770b\u56fe<\/h5>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/47.93.162.35\/wp-content\/uploads\/2017\/02\/242475640.png\" alt=\"\" width=\"800\" height=\"458\" class=\"alignnone size-full wp-image-325\" srcset=\"http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/242475640.png 800w, http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/242475640-300x172.png 300w, http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/242475640-768x440.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<h5>\u5185\u5b58\u5c11\u4e86100\u591aMB\uff0c\u5f88\u5f00\u5fc3\uff0c\u7f51\u7ad9\u4e5f\u5feb\u4e86\u4e9b\uff0c\u6ca1\u6709\u90a3\u4e48\u5361\u4e86\uff0c<\/h5>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/47.93.162.35\/wp-content\/uploads\/2017\/02\/242501906.png\" alt=\"\" width=\"558\" height=\"392\" class=\"alignnone size-full wp-image-324\" srcset=\"http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/242501906.png 558w, http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/242501906-300x211.png 300w\" sizes=\"auto, (max-width: 558px) 100vw, 558px\" \/><\/p>\n<h5>\u5c31\u8fd9\u6837\uff0c\u6211\u7684apache\u7ec8\u4e8e\u5f04\u597d\u4e86\uff0c\u5173\u4e8e\u4fee\u6539\u7684apache\u53c2\u6570\u7684\u542b\u4e49\u6709\u5fc5\u8981\u53d1\u4e00\u4e0b\uff0c\u6bd5\u7adf\u662f\u5b66\u8ba1\u7b97\u673a\u7684<\/h5>\n<p>\u8fd9\u51e0\u4e2a\u53c2\u6570\u610f\u601d\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>StartServers 8\n<ul>\n<li>\u542f\u52a8\u65f6\u9ed8\u8ba4\u542f\u52a8\u7684\u8fdb\u7a0b\u6570<\/li>\n<\/ul>\n<\/li>\n<li>MinSpareServers 5\n<ul>\n<li>MinSpareServers\u6307\u4ee4\u8bbe\u7f6e\u7a7a\u95f2\u5b50\u8fdb\u7a0b\u7684\u6700\u5c0f\u6570\u91cf\u3002\u6240\u8c13\u7a7a\u95f2\u5b50\u8fdb\u7a0b\u662f\u6307\u6ca1\u6709\u6b63\u5728\u5904\u7406\u8bf7\u6c42\u7684\u5b50\u8fdb\u7a0b\u3002\u5982\u679c\u5f53\u524d\u7a7a\u95f2\u5b50\u8fdb\u7a0b\u6570\u5c11\u4e8eMinSpareServers \uff0c\u90a3\u4e48Apache\u5c06\u4ee5\u7b2c\u4e00\u79d2\u4e00\u4e2a\uff0c\u7b2c\u4e8c\u79d2\u4e24\u4e2a\uff0c\u7b2c\u4e09\u79d2\u56db\u4e2a\uff0c\u6309\u6307\u6570\u9012\u589e\u4e2a\u6570\u7684\u901f\u5ea6\u4ea7\u751f\u65b0\u7684\u5b50\u8fdb\u7a0b\uff08\u6700\u592732\u4e2a\/\u79d2\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>MaxSpareServers 10\n<ul>\n<li>MaxSpareServers\u6307\u4ee4\u8bbe\u7f6e\u7a7a\u95f2\u5b50\u8fdb\u7a0b\u7684\u6700\u5927\u6570\u91cf\u3002\u6240\u8c13\u7a7a\u95f2\u5b50\u8fdb\u7a0b\u662f\u6307\u6ca1\u6709\u6b63\u5728\u5904\u7406\u8bf7\u6c42\u7684\u5b50\u8fdb\u7a0b\u3002\u5982\u679c\u5f53\u524d\u6709\u8d85\u8fc7MaxSpareServers\u6570\u91cf\u7684\u7a7a\u95f2\u5b50\u8fdb\u7a0b\uff0c\u90a3\u4e48\u7236\u8fdb\u7a0b\u5c06\u6740\u6b7b\u591a\u4f59\u7684\u5b50\u8fdb\u7a0b\u3002<\/li>\n<\/ul>\n<\/li>\n<li>ServerLimit\u00a0\u00a0\u00a0\u00a0\u00a0 256\n<ul>\n<li>\u914d\u7f6e\u7684apache\u6700\u5927\u7684\u5e76\u53d1\u54cd\u5e94\u6570\uff0c\u5bf9\u5e94\u7684\u662fapache\u7684\u8fdb\u7a0b\u6570<\/li>\n<\/ul>\n<\/li>\n<li>MaxClients\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 256\n<ul>\n<li>\u8bbe\u5b9aApache\u53ef\u540c\u65f6\u5904\u7406\u7684\u8bf7\u6c42\u6570\u91cf<\/li>\n<li>MaxClients\u4e0d\u5f97\u5927\u4e8eServerLimit\u53c2\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n<li>MaxRequestsPerChild\u00a0 4000\n<ul>\n<li>\u6bcf\u4e2a\u5b50\u8fdb\u7a0b\u7406\u591a\u5c11\u4e2a\u8bf7\u6c42\u540e\u5c06\u81ea\u52a8\u9500\u6bc1\u3002\u5230\u8fbeMaxRequestsPerChild\u7684\u9650\u5236\u540e\uff0c\u5b50\u8fdb\u7a0b\u5c06\u4f1a\u7ed3\u675f\u3002\u5982\u679cMaxRequestsPerChild\u4e3a\u201d0\u2033\uff0c\u5b50\u8fdb\u7a0b\u5c06\u6c38\u8fdc\u4e0d\u4f1a\u7ed3\u675f<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u7ee7\u7eed\u7814\u7a76\uff0c\u8fd9\u662f\u6211\u53c2\u8003\u7684\u4e24\u7bc7\u6587\u7ae0\uff0c<\/h5>\n<p>\u300b\u300b\u300b<a href=\"http:\/\/d.hatena.ne.jp\/pasela\/20090205\/debian_apache\" title=\"\u8fd9\u662f\u90a3\u7bc7\u65e5\u672c\u7684\u6587\u7ae0\u3071\u305b\u3089\u3093\u30e1\u30e2\">\u8fd9\u662f\u90a3\u7bc7\u65e5\u672c\u7684\u6587\u7ae0\u3071\u305b\u3089\u3093\u30e1\u30e2<\/a><\/p>\n<p>\u300b\u300b\u300b<a href=\"https:\/\/www.hrwhisper.me\/optimizing-apache-for-low-memory-ram-vps\/\" title=\"apache \u5728\u4f4e\u914d\u7f6e\u670d\u52a1\u5668\u4e0b\u7684\u4f18\u5316\">apache \u5728\u4f4e\u914d\u7f6e\u670d\u52a1\u5668\u4e0b\u7684\u4f18\u5316<\/a><\/p>\n<h5>\u4e0b\u9762\u8fd9\u7bc7\u6587\u7ae0\u91cc\u6709\u5bf9apache\u670d\u52a1\u5668\u5176\u4ed6\u4f18\u5316\u65b9\u6cd5\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u7b49\u6211\u670d\u52a1\u5668\u5185\u5b58\u5728\u4e0d\u591f\u7684\u65f6\u5019\u6211\u4f1a\u518d\u4f18\u5316\u4e00\u6b21\u3002<\/h5>\n<p>\u300b\u300b\u300b<a href=\"https:\/\/www.asmodeus.cn\/archives\/128\" title=\"APACHE\u5185\u5b58\u5360\u7528\u8fc7\u9ad8\u89e3\u51b3\u65b9\u6848\">APACHE\u5185\u5b58\u5360\u7528\u8fc7\u9ad8\u89e3\u51b3\u65b9\u6848<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u662f\u4e3adebian\u7cfb\u7edf\u5199\u7684\uff0ccentos\u548cubuntu\u53ef\u4ee5\u53bb\u7f51\u4e0a\u770b\u66f4\u597d\u7684\u6587\u7ae0\u3002 \u5982\u9898\uff0c\u8bb0\u5f55\u4eca\u5929\u5927\u6218apache\u2026 <span class=\"read-more\"><a href=\"http:\/\/rain1024.com\/index.php\/2017\/02\/03\/apache-article0013\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":327,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[18],"tags":[37,53,78],"class_list":["post-318","post","type-post","status-publish","format-aside","has-post-thumbnail","hentry","category-technique","tag-apache","tag-linux","tag-server","post_format-post-format-aside"],"_links":{"self":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/comments?post=318"}],"version-history":[{"count":0,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/318\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media\/327"}],"wp:attachment":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media?parent=318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/categories?post=318"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/tags?post=318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}