{"id":108,"date":"2025-11-27T18:08:40","date_gmt":"2025-11-27T10:08:40","guid":{"rendered":"https:\/\/xs.xiaosuo.top\/?p=108"},"modified":"2025-11-27T18:10:10","modified_gmt":"2025-11-27T10:10:10","slug":"vps%e5%ae%89%e5%85%a8%e7%98%a6%e8%ba%ab%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/xs.xiaosuo.top\/index.php\/2025\/11\/27\/vps%e5%ae%89%e5%85%a8%e7%98%a6%e8%ba%ab%e8%84%9a%e6%9c%ac\/","title":{"rendered":"VPS\u5b89\u5168\u7626\u8eab\u811a\u672c"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u8fd0\u884c\u65b9\u6cd5\u81ea\u884c\u7814\u7a76\uff0c\u61d2\u7684\u53bb\u5199\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-luminous-vivid-amber-background-color has-text-color has-background has-link-color wp-elements-138a7f288bb087a74e576fa9bc3dc0bf\"><code><strong># 1) APT \u7f13\u5b58 &amp; \u5b64\u5305\napt-get clean\napt-get autoclean -y\napt-get autoremove --purge -y\n\n# 2) systemd \u65e5\u5fd7\u63a7\u5236\u5728 100MB\njournalctl --vacuum-size=100M\n\n# 3) \u5927\u4e8e 50MB \u7684\u65e5\u5fd7\u6587\u4ef6\u622a\u65ad\uff08\u670d\u52a1\u4e0d\u4e2d\u65ad\uff09\nfind \/var\/log -type f -name \"*.log\" -size +50M -exec truncate -s 0 {} \\;\n\n# 4) \u6e05\u7406\u4e34\u65f6\u76ee\u5f55\uff083 \u5929\u672a\u8bbf\u95ee\uff09\nfind \/tmp -xdev -type f -atime +3 -delete\nfind \/var\/tmp -xdev -type f -atime +3 -delete\n\n# 5) WordPress \u7f13\u5b58\/\u5347\u7ea7\u6b8b\u7559\uff08\u6309\u4f60\u7684\u7ad9\u70b9\u8def\u5f84\uff09\nrm -rf \/home\/web\/html\/\u6362\u6210\u4f60\u7f51\u5740\/wordpress\/wp-content\/{cache,boost-cache,autoptimize,w3tc}\/* 2>\/dev\/null\nrm -rf \/home\/web\/html\/\u6362\u6210\u4f60\u7f51\u5740\/wordpress\/wp-content\/..\/upgrade\/* 2>\/dev\/null\n\n\n# 6) Docker \u5360\u7528\uff08\u4ecd\u5728\u4f7f\u7528 Docker \u7684\u505a\u6cd5\uff09\nif command -v docker >\/dev\/null 2>&amp;1; then\n  docker system df\n  docker container prune -f\n  docker image prune -af\n  docker builder prune -af\n  # \u622a\u65ad\u5de8\u5927\u7684\u5bb9\u5668\u65e5\u5fd7\n  for f in \/var\/lib\/docker\/containers\/*\/*-json.log; do &#91; -f \"$f\" ] &amp;&amp; : > \"$f\"; done\nfi\n\n# \u770b\u770b\u91ca\u653e\u6548\u679c\ndf -hT\ndu -xhd1 \/var | sort -h<\/strong><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd0\u884c\u65b9\u6cd5\u81ea\u884c\u7814\u7a76\uff0c\u61d2\u7684\u53bb\u5199\u4e86<\/p>\n","protected":false},"author":1,"featured_media":110,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"_links":{"self":[{"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":3,"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":116,"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/posts\/108\/revisions\/116"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/media\/110"}],"wp:attachment":[{"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xs.xiaosuo.top\/index.php\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}