{"id":1477,"date":"2014-11-28T23:00:26","date_gmt":"2014-11-28T15:00:26","guid":{"rendered":"http:\/\/www.51cos.com\/?p=1477"},"modified":"2014-11-28T23:00:35","modified_gmt":"2014-11-28T15:00:35","slug":"lnmp%e7%ac%94%e8%ae%b0%ef%bc%9a%e5%ae%89%e8%a3%85-xcache-%e7%bc%93%e5%ad%98%e6%89%a9%e5%b1%95%ef%bc%8c%e9%99%8d%e4%bd%8e%e6%9c%8d%e5%8a%a1%e5%99%a8%e8%b4%9f%e8%bd%bd","status":"publish","type":"post","link":"http:\/\/www.51cos.com\/?p=1477","title":{"rendered":"LNMP\u7b14\u8bb0\uff1a\u5b89\u88c5 Xcache \u7f13\u5b58\u6269\u5c55\uff0c\u964d\u4f4e\u670d\u52a1\u5668\u8d1f\u8f7d"},"content":{"rendered":"<p>XCache \u662f\u4e00\u4e2a\u56fd\u4eba\u5f00\u53d1\u7684\u53c8\u5feb\u53c8\u7a33\u5b9a\u7684 PHP opcode \u7f13\u5b58\u5668. \u7ecf\u8fc7\u826f\u597d\u7684\u6d4b\u8bd5\u5e76\u5728\u5927\u6d41\u91cf\/\u9ad8\u8d1f\u8f7d\u7684\u751f\u4ea7\u673a\u5668\u4e0a\u7a33\u5b9a\u8fd0\u884c\u3002\u7ecf\u8fc7(\u5728 linux \u4e0a)\u6d4b\u8bd5\u5e76\u652f\u6301\u6240\u6709\u73b0\u884c PHP \u5206\u652f\u7684\u6700\u65b0\u53d1\u5e03\u7248\u672c\u3002\u8981\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u8bbf\u95ee\u5b98\u65b9\u6587\u6863\uff1a<a title=\"http:\/\/xcache.lighttpd.net\/\" href=\"http:\/\/xcache.lighttpd.net\/\" target=\"_blank\">http:\/\/xcache.lighttpd.net\/<\/a><\/p>\n<p>lnmp \u5b89\u88c5\u5305\u5df2\u7ecf\u96c6\u6210\u4e86\u5b89\u88c5\u811a\u672c\uff0c\u8fdb\u5165lnmp\u89e3\u538b\u540e\u7684\u76ee\u5f55\uff0c\u6267\u884c\uff1a<strong>.\/xcache.sh<\/strong> \u8fd0\u884c\u540e\u6709\u5982\u4e0b\u63d0\u793a\uff081.1\u7248\u672c\uff09\uff1a<\/p>\n<p><a class=\"highslide-image  \" href=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2014\/11\/0036e336a10755e17454e0b7426e961e.png\"><img loading=\"lazy\" decoding=\"async\" title=\"0108-cmhello_com\" src=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2014\/11\/0036e336a10755e17454e0b7426e961e.png\" alt=\"0108-cmhello_com\" width=\"675\" height=\"279\" data-original=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2014\/11\/0036e336a10755e17454e0b7426e961e.png\" \/><\/a><\/p>\n<p>\u4e00 \u4e2a\u6709\u4e24\u4e2a\u7248\u672c\u53ef\u4ee5\u9009\u62e9\uff0c\u5206\u522b\u662fXCache 2.0.1 \u548cXCache 3.1.0 \uff0c\u5efa\u8bae\u5b89\u88c5 XCache 3.1.0 \u8f93\u5165new \u56de\u8f66\uff0c\u51fa\u73b0\u201cPress any key to start&#8230;or Press Ctrl+c to cancel\u201c\uff0c\u518d\u6b21\u56de\u8f66\u786e\u8ba4\u5373\u53ef\u5f00\u59cb\u5b89\u88c5\u3002\u5b89\u88c5\u8fc7\u7a0b\u4f1a\u8ba9\u4f60\u8f93\u5165 Xcache \u7ba1\u7406\u5458\u5bc6\u7801\uff0c\u8f93\u5165\u5373\u53ef\u3002\u9ed8\u8ba4\u7ba1\u7406\u5458\u7528\u6237\u540d\u662f admin\u3002<\/p>\n<p>\u5b89\u88c5\u597d\u4ee5\u540e\uff0c\u8bbf\u95ee http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP\/xcache\/\u00a0\u00a0\u00a0 \u8f93\u5165admin\u7528\u6237\u540d\u548c\u5bc6\u7801\u5c31\u53ef\u4ee5\u767b\u5f55\u7ba1\u7406\u754c\u9762\uff1a<\/p>\n<p><a class=\"highslide-image\" href=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2014\/11\/fca60178d2a0ae5975ea5da47893b37d.png\"><img loading=\"lazy\" decoding=\"async\" title=\"0109-cmhello_com\" src=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2014\/11\/fca60178d2a0ae5975ea5da47893b37d.png\" alt=\"0109-cmhello_com\" width=\"1014\" height=\"596\" data-original=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2014\/11\/fca60178d2a0ae5975ea5da47893b37d.png\" \/><\/a><\/p>\n<p>\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u201c\u8bca\u65ad\u201d\uff0c\u53ef\u4ee5\u770b\u5230\u4f60\u76ee\u524d\u7684 Xcache \u8bbe\u7f6e\u662f\u5426\u5b58\u5728\u4ec0\u4e48\u95ee\u9898\uff0c\u800c\u4e14\u7ed9\u51fa\u4e86\u89e3\u91ca\u548c\u5efa\u8bae\uff0c\u975e\u5e38\u4eba\u6027\u5316\u3002<\/p>\n<p><a class=\"highslide-image\" href=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2014\/11\/e1df6c09fd2d97dc398f2ffe998b335c.png\"><img loading=\"lazy\" decoding=\"async\" title=\"0110-cmhello_com\" src=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2014\/11\/e1df6c09fd2d97dc398f2ffe998b335c.png\" alt=\"0110-cmhello_com\" width=\"1014\" height=\"561\" data-original=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2014\/11\/e1df6c09fd2d97dc398f2ffe998b335c.png\" \/><\/a><\/p>\n<p>Xcache \u7684\u8bbe\u7f6e\u9009\u9879\u5728 php.ini \u91cc\uff0clnmp 1.1 \u81ea\u52a8\u6dfb\u52a0\u7684\u5982\u4e0b\uff1a<\/p>\n<pre class=\"prettyprint linenums\">    ;xcache<br \/>\n    [xcache-common]<br \/>\n    extension = xcache.so<\/p>\n<p>    [xcache.admin]<br \/>\n    xcache.admin.enable_auth = On<\/p>\n<p>    ;\u9ed8\u8ba4\u7684\u7ba1\u7406\u5458\u7528\u6237\u540d\uff0c\u4f60\u53ef\u4ee5\u4fee\u6539 admin \u4e3a\u5176\u4ed6\u7528\u6237\u540d<br \/>\n    xcache.admin.user = \"admin\" <\/p>\n<p>    ;run: echo -n \"yourpassword\" |md5sum |awk '{print }' to get md5 password \u4ee5\u4e0b\u662f\u5bc6\u7801\uff0c\u5c31\u662f\u5b89\u88c5\u65f6\u8bbe\u7f6e\u7684\uff08MD5\u52a0\u5bc6\uff09<br \/>\n    xcache.admin.pass = \"5ed1b644b258a5cc83\"<\/p>\n<p>    [xcache]<br \/>\n    xcache.shm_scheme =        \"mmap\"<\/p>\n<p>    ;\u5bf9\u8c61\u7f13\u5b58\u7684\u5927\u5c0f\uff0c\u9ed8\u8ba4\u597d\u50cf\u662f20M\uff0c\u53ef\u80fd\u4e0d\u591f\u7528\uff0c\u81ea\u5df1\u4fee\u6539\u5927\u4e9b<br \/>\n    xcache.size  =               20M<br \/>\n    ; set to cpu count (cat \/proc\/cpuinfo |grep -c processor)<br \/>\n    xcache.count =                 1<br \/>\n    xcache.slots =                8K<br \/>\n    xcache.ttl   =                 0<br \/>\n    xcache.gc_interval =           0<\/p>\n<p>    ;\u53d8\u91cf\u7f13\u5b58\u5927\u5c0f\uff0c\u9ed8\u8ba4\u662f 4M\uff0c\u4e00\u822c\u7684\u7a0b\u5e8f\u662f\u6ca1\u6709\u7528\u5230\u8fd9\u4e2a\u7f13\u5b58\u7684\uff0c\u53ef\u4ee5\u4e0d\u7406\u4f1a<br \/>\n    xcache.var_size  =            4M<br \/>\n    xcache.var_count =             1<br \/>\n    xcache.var_slots =            8K<br \/>\n    xcache.var_ttl   =             0<br \/>\n    xcache.var_maxttl   =          0<br \/>\n    xcache.var_gc_interval =     300<br \/>\n    xcache.readonly_protection = Off<br \/>\n    ; for *nix, xcache.mmap_path is a file path, not directory. (auto create\/overwrite)<br \/>\n    ; Use something like \"\/tmp\/xcache\" instead of \"\/dev\/*\" if you want to turn on ReadonlyProtection<br \/>\n    ; different process group of php won't share the same \/tmp\/xcache<br \/>\n    xcache.mmap_path =    \"\/dev\/zero\"<br \/>\n    xcache.coredump_directory =   \"\"<br \/>\n    xcache.experimental =        Off<br \/>\n    xcache.cacher =               On<br \/>\n    xcache.stat   =               On<br \/>\n    xcache.optimizer =           Off<\/p>\n<p>    [xcache.coverager]<br \/>\n    ; enabling this feature will impact performance<br \/>\n    ; enable only if xcache.coverager == On &amp;&amp; xcache.coveragedump_directory == \"non-empty-value\"<br \/>\n    ; enable coverage data collecting and xcache_coverager_start\/stop\/get\/clean() functions<br \/>\n    xcache.coverager =          Off<br \/>\n    xcache.coveragedump_directory = \"\"<br \/>\n    ;xcache end<\/p>\n<p>&nbsp;<\/p>\n<p>\u6211\u4eec\u4e00\u822c\u5c31\u4fee\u6539\u4e00\u4e0b\u7ba1\u7406\u5458\u7528\u6237\u540d xcache.admin.user\u00a0 \u548c\u00a0 \u5bf9\u8c61\u7f13\u5b58\u5927\u5c0f xcache.size\u00a0 \u5373\u53ef\u3002<\/p>\n<p>\u66f4\u8be6\u7ec6\u7684\u8bbe\u7f6e\u8bf4\u660e\uff0c\u8bf7\u770b\u5b98\u65b9\u6587\u6863\uff1a<a title=\"http:\/\/xcache.lighttpd.net\/wiki\/XcacheIni\" href=\"http:\/\/xcache.lighttpd.net\/wiki\/XcacheIni\" target=\"_blank\">http:\/\/xcache.lighttpd.net\/wiki\/XcacheIni<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>XCache \u662f\u4e00\u4e2a\u56fd\u4eba\u5f00\u53d1\u7684\u53c8\u5feb\u53c8\u7a33\u5b9a\u7684 PHP opcode \u7f13\u5b58\u5668. \u7ecf\u8fc7\u826f\u597d\u7684\u6d4b\u8bd5\u5e76\u5728\u5927\u6d41\u91cf\/\u9ad8\u8d1f\u8f7d\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-1477","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1477"}],"version-history":[{"count":0,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1477\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1477"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}