{"id":41770,"date":"2024-10-02T07:56:39","date_gmt":"2024-10-01T23:56:39","guid":{"rendered":"https:\/\/server.hk\/cnblog\/41770\/"},"modified":"2024-10-02T07:56:39","modified_gmt":"2024-10-01T23:56:39","slug":"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e4%bd%bf%e7%94%a8mod_socache_shmcb%e8%a8%ad%e5%ae%9aapache-2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/41770\/","title":{"rendered":"Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528mod_socache_shmcb\u8a2d\u5b9aApache"},"content":{"rendered":"<h1 id=\"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e4%bd%bf%e7%94%a8mod_socache_shmcb%e8%a8%ad%e5%ae%9aapache-eftQWeaivY\">Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528mod_socache_shmcb\u8a2d\u5b9aApache<\/h1>\n<p>Apache HTTP Server\u662f\u4e00\u500b\u5ee3\u6cdb\u4f7f\u7528\u7684\u958b\u6e90\u7db2\u9801\u4f3a\u670d\u5668\uff0c\u56e0\u5176\u9748\u6d3b\u6027\u548c\u53ef\u64f4\u5c55\u6027\u800c\u53d7\u5230\u8a31\u591a\u7db2\u7ad9\u7684\u9752\u775e\u3002\u5728Apache\u4e2d\uff0c\u6a21\u7d44\u5316\u7684\u8a2d\u8a08\u4f7f\u5f97\u7528\u6236\u53ef\u4ee5\u6839\u64da\u9700\u6c42\u9078\u64c7\u4e0d\u540c\u7684\u529f\u80fd\u6a21\u7d44\u4f86\u589e\u5f37\u4f3a\u670d\u5668\u7684\u6027\u80fd\u3002\u5176\u4e2d\uff0c<code>mod_socache_shmcb<\/code>\u662f\u4e00\u500b\u7528\u65bc\u5feb\u53d6\u7684\u6a21\u7d44\uff0c\u80fd\u5920\u6709\u6548\u5730\u63d0\u9ad8\u4f3a\u670d\u5668\u7684\u97ff\u61c9\u901f\u5ea6\u548c\u6027\u80fd\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afmod_socache_shmcb%ef%bc%9f-eftQWeaivY\">\u4ec0\u9ebc\u662fmod_socache_shmcb\uff1f<\/h2>\n<p><code>mod_socache_shmcb<\/code>\u662fApache\u7684\u4e00\u500b\u5171\u4eab\u5feb\u53d6\u6a21\u7d44\uff0c\u4f7f\u7528\u5171\u4eab\u5167\u5b58\u4f86\u5b58\u5132\u5feb\u53d6\u6578\u64da\u3002\u9019\u610f\u5473\u8457\u591a\u500bApache\u5de5\u4f5c\u9032\u7a0b\u53ef\u4ee5\u8a2a\u554f\u540c\u4e00\u5feb\u53d6\u6578\u64da\uff0c\u5f9e\u800c\u6e1b\u5c11\u91cd\u8907\u8a08\u7b97\u548c\u6578\u64da\u5b58\u53d6\u7684\u6642\u9593\u3002\u9019\u5c0d\u65bc\u9700\u8981\u983b\u7e41\u8a2a\u554f\u76f8\u540c\u6578\u64da\u7684\u61c9\u7528\u7a0b\u5e8f\u4f86\u8aaa\uff0c\u80fd\u986f\u8457\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9dmod_socache_shmcb-eftQWeaivY\">\u5b89\u88ddmod_socache_shmcb<\/h2>\n<p>\u5728\u5927\u591a\u6578\u60c5\u6cc1\u4e0b\uff0c<code>mod_socache_shmcb<\/code>\u6703\u96a8\u8457Apache\u7684\u5b89\u88dd\u81ea\u52d5\u5305\u542b\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fLinux\u7cfb\u7d71\uff0c\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u6a21\u7d44\u662f\u5426\u5df2\u555f\u7528\uff1a<\/p>\n<pre><code>apachectl -M | grep socache_shmcb<\/code><\/pre>\n<p>\u5982\u679c\u6c92\u6709\u986f\u793a\u4efb\u4f55\u7d50\u679c\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u7de8\u8f2fApache\u7684\u914d\u7f6e\u6587\u4ef6\u4f86\u555f\u7528\u5b83\u3002\u901a\u5e38\uff0c\u9019\u500b\u6587\u4ef6\u4f4d\u65bc<code>\/etc\/httpd\/conf\/httpd.conf<\/code>\u6216<code>\/etc\/apache2\/apache2.conf<\/code>\u3002\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre><code>LoadModule socache_shmcb_module modules\/mod_socache_shmcb.so<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%aemod_socache_shmcb-eftQWeaivY\">\u914d\u7f6emod_socache_shmcb<\/h2>\n<p>\u555f\u7528\u6a21\u7d44\u5f8c\uff0c\u60a8\u9700\u8981\u914d\u7f6e\u5b83\u4ee5\u4fbf\u958b\u59cb\u4f7f\u7528\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u57fa\u672c\u7684\u914d\u7f6e\u793a\u4f8b\uff1a<\/p>\n<pre><code>&lt;IfModule socache_shmcb_module&gt;\n    SocacheShmcbInit 10 1000000\n&lt;\/IfModule&gt;<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c<code>SocacheShmcbInit<\/code>\u6307\u4ee4\u7684\u7b2c\u4e00\u500b\u53c3\u6578\u662f\u5feb\u53d6\u7684\u6578\u91cf\uff0c\u7b2c\u4e8c\u500b\u53c3\u6578\u662f\u6bcf\u500b\u5feb\u53d6\u7684\u5927\u5c0f\uff08\u4ee5\u5b57\u7bc0\u70ba\u55ae\u4f4d\uff09\u3002\u9019\u610f\u5473\u8457\u6211\u5011\u5c07\u5275\u5efa10\u500b\u5feb\u53d6\uff0c\u6bcf\u500b\u5feb\u53d6\u7684\u5927\u5c0f\u70ba1MB\u3002<\/p>\n<h2 id=\"%e4%bd%bf%e7%94%a8mod_socache_shmcb%e9%80%b2%e8%a1%8c%e5%bf%ab%e5%8f%96-eftQWeaivY\">\u4f7f\u7528mod_socache_shmcb\u9032\u884c\u5feb\u53d6<\/h2>\n<p>\u4e00\u65e6\u914d\u7f6e\u5b8c\u6210\uff0c\u60a8\u53ef\u4ee5\u958b\u59cb\u4f7f\u7528\u5feb\u53d6\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u4f7f\u7528<code>mod_socache_shmcb<\/code>\u9032\u884c\u5feb\u53d6\u7684\u793a\u4f8b\uff1a<\/p>\n<pre><code>&lt;IfModule mod_cache.c&gt;\n    CacheEnable socache \/\n    CacheSocache shmcb\n&lt;\/IfModule&gt;<\/code><\/pre>\n<p>\u9019\u6bb5\u4ee3\u78bc\u544a\u8a34Apache\u4f7f\u7528<code>mod_cache<\/code>\u6a21\u7d44\u4f86\u555f\u7528\u5feb\u53d6\uff0c\u4e26\u6307\u5b9a\u4f7f\u7528<code>mod_socache_shmcb<\/code>\u4f5c\u70ba\u5feb\u53d6\u7684\u5f8c\u7aef\u3002<\/p>\n<h2 id=\"%e6%aa%a2%e6%9f%a5%e5%bf%ab%e5%8f%96%e6%95%88%e6%9e%9c-eftQWeaivY\">\u6aa2\u67e5\u5feb\u53d6\u6548\u679c<\/h2>\n<p>\u8981\u6aa2\u67e5\u5feb\u53d6\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Apache\u7684\u65e5\u8a8c\u529f\u80fd\u3002\u555f\u7528\u65e5\u8a8c\u5f8c\uff0c\u60a8\u53ef\u4ee5\u67e5\u770b\u8acb\u6c42\u7684\u8655\u7406\u6642\u9593\uff0c\u4e26\u78ba\u8a8d\u5feb\u53d6\u662f\u5426\u5728\u6e1b\u5c11\u4f3a\u670d\u5668\u7684\u8ca0\u64d4\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-eftQWeaivY\">\u7e3d\u7d50<\/h2>\n<p>\u4f7f\u7528<code>mod_socache_shmcb<\/code>\u4f86\u914d\u7f6eApache\u4f3a\u670d\u5668\u7684\u5feb\u53d6\u529f\u80fd\uff0c\u53ef\u4ee5\u986f\u8457\u63d0\u9ad8\u7db2\u7ad9\u7684\u6027\u80fd\u548c\u97ff\u61c9\u901f\u5ea6\u3002\u901a\u904e\u5171\u4eab\u5167\u5b58\u7684\u65b9\u5f0f\uff0c\u9019\u500b\u6a21\u7d44\u80fd\u5920\u6709\u6548\u5730\u6e1b\u5c11\u91cd\u8907\u8a08\u7b97\u548c\u6578\u64da\u5b58\u53d6\u7684\u6642\u9593\uff0c\u7279\u5225\u9069\u5408\u9ad8\u6d41\u91cf\u7684\u7db2\u7ad9\u3002\u82e5\u60a8\u9700\u8981\u9032\u4e00\u6b65\u4e86\u89e3<code>VPS<\/code>\u3001<code>\u9999\u6e2fVPS<\/code>\u6216\u5176\u4ed6\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9 <a href=\"https:\/\/server.hk\">Server.HK<\/a>\uff0c\u7372\u53d6\u66f4\u591a\u8cc7\u8a0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66\u4e60\u5982\u4f55\u4f7f\u7528mod_socache_shmcb\u5728Apache\u4e2d\u8bbe\u7f6e\u5171\u4eab\u5185\u5b58\u7f13\u5b58\uff0c\u63d0\u9ad8\u7f51\u7ad9\u6027\u80fd\u548c\u54cd\u5e94\u901f\u5ea6\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-41770","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=41770"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41770\/revisions"}],"predecessor-version":[{"id":41771,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41770\/revisions\/41771"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=41770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=41770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=41770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}