{"id":2184,"date":"2024-04-10T14:46:22","date_gmt":"2024-04-10T06:46:22","guid":{"rendered":"https:\/\/qishiya.com\/?p=2184"},"modified":"2024-04-10T14:55:00","modified_gmt":"2024-04-10T06:55:00","slug":"%e6%80%8e%e4%b9%88%e6%a0%b7%e6%8a%8a-wordpress-%e7%9a%84%e5%9b%be%e7%89%87%e5%ad%98%e5%82%a8%e8%bf%81%e7%a7%bb%e5%88%b0-cloudflare-r2","status":"publish","type":"post","link":"https:\/\/qishiya.com\/?p=2184","title":{"rendered":"\u600e\u4e48\u6837\u628a wordpress \u7684\u56fe\u7247\u5b58\u50a8\u8fc1\u79fb\u5230 Cloudflare R2"},"content":{"rendered":"\n<p>\u56e0\u4e3a\u7f51\u7ad9\u4e0a\u6709\u5927\u91cf\u7684\u89c6\u9891\uff0c\u867d\u7136\u5728hetznert\u79df\u7684\u673a\u5668\u5b58\u50a8\u548c\u5e26\u5bbd\u90fd\u591f\u7528\uff0c\u4f46\u662f\u6211\u8ba4\u4e3a\u8fd9\u4e9b\u89c6\u9891\u548c\u56fe\u7247\u6ca1\u5fc5\u8981\u653e\u5230\u81ea\u5df1\u7684\u4e3b\u673a\u4e0a\uff0c\u76f4\u63a5\u653e\u5230\u4e91\u5b58\u50a8\u91cc\u9762\u6700\u4f18\uff0c\u6211\u57fa\u672c\u4e0a\u7528\u4e86 cloudflare \u7684\u5168\u5bb6\u6876\uff0c\u5e72\u8106\u628a\u4e91\u5b58\u50a8 R2 \u4e5f\u7ed9\u7528\u4e0a\u4e86\uff0c\u4f46\u6700\u4e3b\u8981\u7684\u95ee\u9898\u662f\u600e\u4e48\u6837\u8fc1\u79fb\uff0c\u56e0\u4e3a\u6709\u51e0\u4e07\u5f20\u56fe\u7247\u5728 hetznert \u7684\u673a\u5668\u4e0a\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_61 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ff6200;color:#ff6200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ff6200;color:#ff6200\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/qishiya.com\/?p=2184\/#%E8%BF%81%E7%A7%BB%E5%87%86%E5%A4%87\" title=\"\u8fc1\u79fb\u51c6\u5907\">\u8fc1\u79fb\u51c6\u5907<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/qishiya.com\/?p=2184\/#rclone_%E5%85%A5%E6%A1%B6\" title=\"rclone \u5165\u6876\">rclone \u5165\u6876<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/qishiya.com\/?p=2184\/#%E5%A4%87%E4%BB%BD\" title=\"\u5907\u4efd\">\u5907\u4efd<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/qishiya.com\/?p=2184\/#%E6%9B%B4%E6%94%B9%E6%95%B0%E6%8D%AE%E5%BA%93\" title=\"\u66f4\u6539\u6570\u636e\u5e93\">\u66f4\u6539\u6570\u636e\u5e93<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/qishiya.com\/?p=2184\/#%E5%AE%89%E8%A3%85better-search-replace\" title=\"\u5b89\u88c5better-search-replace\">\u5b89\u88c5better-search-replace<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%BF%81%E7%A7%BB%E5%87%86%E5%A4%87\"><\/span>\u8fc1\u79fb\u51c6\u5907<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u9996\u5148\u8981\u5728 R2 \u4e0a\u9762\u5f00\u901a\u8d26\u6237\uff0c\u7ed1\u5b9a\u94f6\u884c\u5361\uff0c\u5efa\u597d bucket\uff0c\u7533\u8bf7 access key\/secret \u4e4b\u7c7b\uff0c\u8fd9\u4e2a\u7b80\u5355\uff0c\u6587\u7ae0\u591a\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"rclone_%E5%85%A5%E6%A1%B6\"><\/span>rclone \u5165\u6876<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u7528 rclone \u628a\u73b0\u6709\u7684\u56fe\u7247copy \u5230 R2 \u7684\u6876\u91cc\uff0c\u8fd9\u4e2a\u8fc7\u7a0b copy \u4e86\u4e00\u6574\u4e2a\u665a\u4e0a\u624d\u5b8c\u6210\uff0c\u53ef\u80fd\u662f\u4ece\u6b27\u6d32\u5230\u4e9a\u592a\u8d70\u7684\u662f\u516c\u7f51\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%A4%87%E4%BB%BD\"><\/span>\u5907\u4efd<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5907\u4efd\u6570\u636e\u5e93\u548c\u6574\u4e2a\u7f51\u7ad9\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9B%B4%E6%94%B9%E6%95%B0%E6%8D%AE%E5%BA%93\"><\/span>\u66f4\u6539\u6570\u636e\u5e93<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code> UPDATE wp_options SET option_value = 'https:\/\/media.xxxxx.com' WHERE option_name = 'upload_url_path' LIMIT  1;\n<\/code><\/pre>\n\n\n\n<p>\u628a\u7f51\u7ad9\u7684libraray \u57df\u540d\u66f4\u65b0\uff0c\u9ed8\u8ba4\u662f wordpress \u4e3b\u57df\u540d\uff0c\u8fc1\u79fb\u5230\u4e86 R2 \uff0c\u80af\u5b9a\u662f\u8981\u7528\u5355\u72ec\u57df\u540d\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%AE%89%E8%A3%85better-search-replace\"><\/span>\u5b89\u88c5better-search-replace<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u8fd9\u4e2a\u63d2\u4ef6\u80fd\u5e2e\u4f60\u76f4\u63a5\u628a\u9ed8\u8ba4\u7684\u8fde\u63a5\u66ff\u6362\u5230 R2 \u7684\u8fde\u63a5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u628a https:\/\/www.xxxxx.com\/wp-content\/uploads\/ \u66ff\u6362\u4e3a  https:\/\/media.xxxxx.com\/<\/code><\/pre>\n\n\n\n<p>\u6211\u8ba4\u4e3a\u8fd9\u79cd\u65b9\u5f0f\u662f\u6700\u5feb\u6700\u7b80\u5355\u7684\u8fc1\u79fb\u65b9\u5f0f\uff0c\u5982\u679c\u4f60\u8fd8\u4e0d\u653e\u5fc3\uff0c\u8981\u4ee5\u5728 nginx \u4e0a\u505a\u4e00\u4e2a rewrite \u4e4b\u7c7b\u7684\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/www.webnots.com\/move-wordpress-images-folder-to-subdomain\">https:\/\/www.webnots.com\/move-wordpress-images-folder-to-subdomain<\/a><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-wordpress-developer-resources wp-block-embed-wordpress-developer-resources\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"EzF3GzneWV\"><a href=\"https:\/\/developer.wordpress.org\/advanced-administration\/upgrade\/migrating\/\">Migrating WordPress<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Migrating WordPress&#8221; &#8212; WordPress Developer Resources\" src=\"https:\/\/developer.wordpress.org\/advanced-administration\/upgrade\/migrating\/embed\/#?secret=PjkoLSGpcv#?secret=EzF3GzneWV\" data-secret=\"EzF3GzneWV\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u56e0\u4e3a\u7f51\u7ad9\u4e0a\u6709\u5927\u91cf\u7684\u89c6\u9891\uff0c\u867d\u7136\u5728hetznert\u79df\u7684\u673a\u5668\u5b58\u50a8\u548c\u5e26\u5bbd\u90fd\u591f\u7528\uff0c\u4f46\u662f\u6211\u8ba4\u4e3a\u8fd9\u4e9b\u89c6\u9891\u548c\u56fe\u7247\u6ca1\u5fc5\u8981\u653e\u5230\u81ea\u5df1\u7684\u4e3b\u673a\u4e0a\uff0c\u76f4\u63a5\u653e\u5230\u4e91\u5b58\u50a8\u91cc\u9762\u6700\u4f18\uff0c\u6211\u57fa\u672c\u4e0a\u7528\u4e86 cloudflare \u7684\u5168\u5bb6\u6876\uff0c\u5e72\u8106\u628a\u4e91\u5b58\u50a8 R2 \u4e5f\u7ed9\u7528\u4e0a\u4e86\uff0c\u4f46\u6700\u4e3b\u8981\u7684\u95ee\u9898\u662f\u600e &#8230; <a title=\"\u600e\u4e48\u6837\u628a wordpress \u7684\u56fe\u7247\u5b58\u50a8\u8fc1\u79fb\u5230 Cloudflare R2\" class=\"read-more\" href=\"https:\/\/qishiya.com\/?p=2184\" aria-label=\"\u66f4\u591a \u600e\u4e48\u6837\u628a wordpress \u7684\u56fe\u7247\u5b58\u50a8\u8fc1\u79fb\u5230 Cloudflare R2\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[639,597],"tags":[684,685],"class_list":["post-2184","post","type-post","status-publish","format-standard","hentry","category-woocommerece","category-wordpress","tag-cloudflare-r2","tag-685"],"_links":{"self":[{"href":"https:\/\/qishiya.com\/index.php?rest_route=\/wp\/v2\/posts\/2184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qishiya.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qishiya.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qishiya.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qishiya.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2184"}],"version-history":[{"count":2,"href":"https:\/\/qishiya.com\/index.php?rest_route=\/wp\/v2\/posts\/2184\/revisions"}],"predecessor-version":[{"id":2188,"href":"https:\/\/qishiya.com\/index.php?rest_route=\/wp\/v2\/posts\/2184\/revisions\/2188"}],"wp:attachment":[{"href":"https:\/\/qishiya.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qishiya.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qishiya.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}