{"id":659,"date":"2020-03-17T19:41:12","date_gmt":"2020-03-17T19:41:12","guid":{"rendered":"https:\/\/haoyuan.info\/?p=659"},"modified":"2020-03-17T19:41:12","modified_gmt":"2020-03-17T19:41:12","slug":"%e4%b8%bawordpress%e9%85%8d%e7%bd%aecaddyfile","status":"publish","type":"post","link":"https:\/\/haoyuan.info\/?p=659","title":{"rendered":"\u4e3aWordPress\u914d\u7f6eCaddyfile"},"content":{"rendered":"<h2>\u80cc\u666f<\/h2>\n<p>\u6211\u4eec\u77e5\u9053Caddy server\u662f\u4e00\u6b3e\u57fa\u4e8eGo\u7f16\u5199\uff0c\u53ef\u4ee5\u81ea\u52a8\u914d\u7f6eSSL\u8bc1\u4e66\u7684Web Server\u3002<br \/>\n\u800c\u5b98\u65b9\u5e76\u6ca1\u6709\u7ed9\u51faCaddy\u9488\u5bf9Wordpress\u7684example\u3002<br \/>\n\u56e0\u6b64\u8fd9\u91cc\u63d0\u4f9b\u4e86\u4e00\u4e2awordpress\u7684caddyfile\u7684\u4f8b\u5b50\u3002<br \/>\n\u540c\u65f6\u8be5caddyfile\u652f\u6301Yoast SEO\u7684sitemap\u7684rewrite\u3002<\/p>\n<h2>\u51c6\u5907<\/h2>\n<ul>\n<li>Caddyserver v1<\/li>\n<li>php-fpm<\/li>\n<li>\u51c6\u5907\u597d\u7684wordpress\u7f51\u7ad9<\/li>\n<\/ul>\n<h2>\u6b63\u6587<\/h2>\n<p>\u8fdb\u5165\u7f51\u7ad9\u5bf9\u5e94\u7684Caddyfile, \u586b\u5165\u4ee5\u4e0b\u5185\u5bb9<\/p>\n<pre><code class=\"\">\u4f60\u7684\u57df\u540d {\n    gzip\n    log \/var\/log\/caddy\/site-access.log\n    fastcgi \/ \/run\/php\/php7.2-fpm.sock php {\n\n    }\n    root #wordpress\u76ee\u5f55\n    rewrite {\n        r \/uploads\\\/(.*)\\.php\n        to \/\n}\n    rewrite {\n        r ^\/sitemap_index.xml$\n        to \/index.php?sitemap=1\n    }\n    rewrite {\n        r ^\/([^\/]+?)-sitemap([0-9]+)?.xml$\n        to \/index.php?sitemap={1}&amp;sitemap_n={2}\n    }\n\n    rewrite {\n          if {path} not_match ^\\\/wp-admin\n          to {path} {path}\/ \/index.php?{query}\n    }\n}\n<\/code><\/pre>\n<p>\u5176\u4e2d<code>fastcgi<\/code>\u5b57\u6bb5\u7684<code>\/run\/php\/php7.2-fpm.sock<\/code>\u53ef\u4ee5\u6539\u6210\u7aef\u53e3\uff0c\u4e5f\u53ef\u4ee5\u6539\u6210sock\u5957\u63a5\u5b57\u3002\u53ef\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u66f4\u6539\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u6211\u4eec\u77e5\u9053Caddy server\u662f\u4e00\u6b3e\u57fa\u4e8eGo\u7f16\u5199\uff0c\u53ef\u4ee5\u81ea\u52a8\u914d\u7f6eSSL\u8bc1\u4e66\u7684Web Server\u3002 \u800c\u5b98 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[62],"tags":[76,15,14],"class_list":["post-659","post","type-post","status-publish","format-standard","hentry","category-62","tag-caddy","tag-php","tag-wordpress"],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8UC2c-aD","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/haoyuan.info\/index.php?rest_route=\/wp\/v2\/posts\/659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haoyuan.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haoyuan.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haoyuan.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haoyuan.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=659"}],"version-history":[{"count":0,"href":"https:\/\/haoyuan.info\/index.php?rest_route=\/wp\/v2\/posts\/659\/revisions"}],"wp:attachment":[{"href":"https:\/\/haoyuan.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haoyuan.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haoyuan.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}