{"id":547,"date":"2022-01-27T20:30:33","date_gmt":"2022-01-27T12:30:33","guid":{"rendered":"https:\/\/www.naturalbase.cn\/?p=547"},"modified":"2023-01-31T18:00:03","modified_gmt":"2023-01-31T10:00:03","slug":"%e6%90%ad%e5%bb%ba%e5%ae%9e%e9%aa%8c%e5%ae%a4%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.naturalbase.cn\/%e6%90%ad%e5%bb%ba%e5%ae%9e%e9%aa%8c%e5%ae%a4%e6%9c%8d%e5%8a%a1%e5%99%a8\/","title":{"rendered":"\u642d\u5efa\u5b9e\u9a8c\u5ba4\u670d\u52a1\u5668"},"content":{"rendered":"
2022-01-27 20:30:12 \u661f\u671f\u56db<\/p>\n
<\/p>\n
\u8fd9\u4efd\u6587\u6863\u8bb0\u5f55\u6211\u5728\u5b9e\u9a8c\u5ba4\u642d\u5efa\u534f\u4f5c\u5e73\u53f0\u7684\u65b9\u6848\u8fed\u4ee3\u8fc7\u7a0b\u3001\u6240\u4f7f\u7528\u7684\u65b9\u6cd5\u4ee5\u53ca\u7b80\u7565\u6b65\u9aa4\u3002<\/p>\n
\u5728\u505a\u8fd9\u4e2a\u5e73\u53f0\u4e4b\u524d\uff0c\u6211\u5bf9\u670d\u52a1\u5668\u642d\u5efa\u4e00\u7a8d\u4e0d\u901a\uff0c\u505a\u5b8c\u4e4b\u540e\uff0c\u6211\u5bf9\u670d\u52a1\u5668\u642d\u5efa\u6709\u4e86\u5927\u6982\u7684\u7406\u89e3\uff0c\u51fa\u73b0\u95ee\u9898\u4e5f\u80fd\u6709\u4e2a\u5927\u6982\u7684\u65b9\u5411\u53bb\u5bfb\u627e\u89e3\u51b3\u7684\u529e\u6cd5\u3002<\/p>\n
\u5f53\u65f6\u642d\u5efa\u7684\u534f\u4f5c\u5e73\u53f0\u6240\u9700\u8981\u5b8c\u6210\u7684\u4e3b\u8981\u529f\u80fd\u6709\uff1a\u77e5\u8bc6\u5e93\u3001\u7f51\u76d8\u4ee5\u53cagit\u3002\u5176\u4e2d\u77e5\u8bc6\u5e93\u6211\u4eec\u4f7f\u7528\u7684\u662fwordpress\uff0c\u642d\u914dwedocs\u505a\u77e5\u8bc6\u5e93\u8fd8\u4e0d\u9519\uff1b\u7f51\u76d8\u7528\u7684\u662fnextcloud\uff0cgit\u7528\u7684\u662fgitea\uff0c\u90fd\u662f\u5f00\u6e90\u514d\u8d39\u7684\u9879\u76ee\u3002<\/p>\n
wordpress\u7684\u7075\u6d3b\u6027\u7279\u522b\u5927\uff0c\u672c\u6765\u662f\u88ab\u7528\u6765\u505a\u7f51\u7ad9\u7684\uff0c\u4f46\u662f\u4ed6\u5305\u542b\u4e86\u975e\u5e38\u591a\u7684\u63d2\u4ef6\uff0c\u4f60\u53ef\u4ee5\u6309\u7167\u4f60\u7684\u9700\u6c42\u7ec4\u88c5\u63d2\u4ef6\uff0c\u4f7fwordpress\u5177\u6709\u5176\u4ed6\u529f\u80fd\u3002<\/p>\n
\u5728\u672c\u6587\u6863\u4e2d\uff0c\u5c31\u4ee5\u57fa\u4e8ewordpress\u642d\u5efa\u4e2a\u4eba\u7f51\u7ad9\u4e3a\u4f8b\u5b50\uff0c\u8bb2\u89e3\u5982\u4f55\u642d\u5efa\u670d\u52a1\uff0c\u642d\u5efa\u7f51\u7ad9\u3001git\u90fd\u53ef\u4ee5\u7528\u540c\u6837\u7684\u5957\u8def\u3002<\/p>\n
\u672c\u6587\u6863\u4e0e\u4e2a\u4eba\u7f51\u7ad9\u642d\u5efa\u6559\u7a0b\u7684\u533a\u522b
\n\u7f51\u4e0a\u5173\u4e8e\u642d\u5efa\u4e2a\u4eba\u7f51\u7ad9\u7684\u6559\u7a0b\u975e\u5e38\u591a\uff0c\u4f46\u5173\u4e8e\u4e3a\u4ec0\u4e48\u8981\u7528\u8fd9\u4e9b\u5de5\u5177\uff0c\u8fd9\u4e9b\u5de5\u5177\u4e4b\u95f4\u7684\u8054\u7cfb\u662f\u4ec0\u4e48\uff0c\u53e6\u5916\uff0c\u5173\u4e8e\u7f51\u7ad9\u5b8c\u5584\u7684\u6587\u7ae0\u4e5f\u6bd4\u8f83\u5c11\u3002<\/p>\n
\u6240\u4ee5\uff0c\u6211\u5e0c\u671b\u80fd\u5199\u4e00\u4efd\u6587\u6863\uff0c\u8bb2\u6e05\u695a\u7f51\u7ad9\u642d\u5efa\u7684\u6765\u9f99\u53bb\u8109\uff0c\u5e0c\u671b\u80fd\u5728\u8bfb\u8005\u8111\u4e2d\u5efa\u7acb\u8d77\u5e38\u7528\u670d\u52a1\u67b6\u6784\u7684\u8f6e\u5ed3\uff0c\u8bfb\u8005\u4e5f\u80fd\u591f\u81ea\u5df1\u52a8\u624b\u642d\u5efa\u81ea\u5df1\u7684\u7f51\u7ad9\u3002<\/p>\n
\u9605\u8bfb\u4e4b\u540e\u4f60\u80fd\u660e\u767d<\/p>\n
\u6240\u8c13\u642d\u5efa\u670d\u52a1\uff0c\u8bf4\u767d\u4e86\u5c31\u662f\u5728\u7535\u8111\u4e0a\u88c5\u4e00\u4e2a\u8f6f\u4ef6\uff0c\u548cwindows\u4e0a\u5b89\u88c5qq\u76f8\u6bd4\uff0c\u9700\u8981\u4f60\u8fdb\u884c\u8003\u8651\uff1a\u8f6f\u4ef6\u4f9d\u8d56\u7684\u8fd0\u884c\u73af\u5883\uff08\u5982LNMP\u548cLAMP\uff09\u3001\u5982\u4f55\u8bbf\u95ee\u3001\u5982\u4f55\u5b89\u5168\u8bbf\u95ee\u7b49\u95ee\u9898\uff0c\u800c\u5b89\u88c5qq\u7b80\u5355\u53ea\u662f\u56e0\u4e3a\u4ed6\u628a\u8fd9\u4e9b\u6b65\u9aa4\u90fd\u5c01\u88c5\u597d\u4e86\uff0c\u4f60\u4e0b\u8f7d\u4e00\u4e2aexe\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n
\u4e0b\u9762\u5c31\u5bf9\u8fd9\u4e9b\u95ee\u9898\u8fdb\u884c\u63a2\u8ba8\u3002<\/p>\n
\u8fd9\u4e00\u6b65\u53ea\u9700\u8981\u4f1alinux\u548cdocker\u6700\u7b80\u5355\u7684\u547d\u4ee4\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n
\u6700\u7b80\u5355\u7684\u7f51\u7ad9<\/strong> \u6bd4\u5982\u642d\u5efa\u4e2a\u4eba\u4e3b\u9875\uff0c\u4f7f\u7528docker pull\u4ecedockerhub\u4e0b\u8f7dwordpress\u955c\u50cf\uff0c\u7136\u540e\u5728\u4e3b\u673a\u4e0adocker run\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4f7f\u7528ip:port\u5bf9\u670d\u52a1\u8fdb\u884c\u8bbf\u95ee\u4e86\u3002<\/p>\n \u8fdb\u4e00\u6b65<\/strong> \u800c\u8fd9\u4e2a\u60f3\u6cd5\u53ef\u4ee5\u4f7f\u7528docker compose<\/strong>\u5b9e\u73b0\uff0cdocker compose\u5c31\u662f\u4f7f\u7528docker-compose.yml\u6587\u4ef6\uff0c\u8fd0\u884c\u591a\u4e2a\u955c\u50cf\uff08wordpress\u3001mysql\u3001phpMyAdmin\uff09\uff0c\u5e76\u5728\u4ed6\u4eec\u4e4b\u95f4\u5efa\u7acb\u8054\u7cfb\u3002<\/p>\n \u4e0a\u4e00\u6b65\u642d\u5efa\u7684\u670d\u52a1\uff0c\u53ea\u80fd\u5728\u540c\u4e00\u4e2a\u5c40\u57df\u7f51\u5185\u8fdb\u884c\u8bbf\u95ee\uff0c\u6bd4\u5982\u4f60\u7684\u670d\u52a1\u5668\u548c\u4f60\u7684\u7535\u8111\u4e0d\u5728\u540c\u4e00\u4e2a\u8def\u7531\u5668\u4e0b\uff0c\u53ef\u80fd\u5c31\u65e0\u6cd5\u8bbf\u95ee\u4e86\u3002<\/p>\n \u5982\u679c\u4f60\u7684\u670d\u52a1\u9700\u8981\u4f7f\u7528\u5916\u7f51\u8fdb\u884c\u8bbf\u95ee\uff0c\u90a3\u5c31\u9700\u8981\u4f7f\u7528\u5230\u5185\u7f51\u7a7f\u900f\uff0c\u5185\u7f51\u7a7f\u900f\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u4e2a\u8f6c\u53d1\u7684\u529f\u80fd\uff0c\u6240\u4ee5\u8fd9\u4e00\u6b65\u9700\u8981\u4f60\u5177\u6709\u516c\u7f51ip<\/strong>\u3002<\/p>\n \u53ef\u4ee5\u662f\u4e00\u53f0\u5177\u6709\u516c\u7f51ip\u7684\u670d\u52a1\u5668\uff08\u5982\u963f\u91cc\u4e91\uff09\uff0c\u4e5f\u6709\u4e00\u4e9b\u5185\u7f51\u7a7f\u900f\u8f6f\u4ef6\u4e5f\u6709\u5355\u5356\u7aef\u53e3\u7ed9\u4f60\u505a\u7a7f\u900f\uff0c\u5982\u679c\u4f60\u7684\u8def\u7531\u5668\u5177\u6709\u516c\u7f51ip\u4e5f\u53ef\u4ee5\u4f7f\u7528\u9759\u6001NAT\u3002<\/p>\n \u5f53\u4f60\u5177\u6709\u516c\u7f51ip\u4e4b\u540e\uff0c\u6211\u4eec\u5c31\u5b9e\u73b0\u5185\u7f51\u7a7f\u900f\u5566\u3002\u4e3b\u8981\u53ef\u4ee5\u4f7f\u7528\u7684\u5de5\u5177\u6709\uff1assh\u3001frp\uff0c\u5176\u4e2dfrp\u4f7f\u7528\u5bc6\u7801\u8fdb\u884c\u8fde\u63a5\uff0c\u53ef\u80fd\u4e0d\u592a\u5b89\u5168\uff0c\u914d\u7f6e\u9879\u76f8\u5bf9\u4e8essh\u6765\u8bf4\u6bd4\u8f83\u4e30\u5bcc\uff08\u9ebb\u70e6\uff09\uff0c\u800c\u4f7f\u7528ssh\u53ef\u4ee5\u4e00\u53e5\u547d\u4ee4\u641e\u5b9a\u3002<\/p>\n \u8fdb\u4e00\u6b65<\/strong> \u57df\u540d\u8bbf\u95ee<\/strong> \u52a0\u5bc6\u4f20\u8f93<\/strong> \u591a\u9879\u670d\u52a1<\/strong> nginx\u914d\u7f6e\u5c5e\u4e8e\u670d\u52a1\u5668\u8fd0\u7ef4\uff0c\u5bf9\u5c0f\u767d\u6765\u8bf4\u8fd8\u662f\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\u7684\uff0c\u6240\u4ee5\u5c31\u6709\u4e86\u4e00\u4e9b\u670d\u52a1\u5668\u8fd0\u7ef4\u53ef\u89c6\u5316\u7684\u8f6f\u4ef6\uff0c\u5982\u5b9d\u5854\u9762\u677f\u3002\u5b9d\u5854\u9762\u677f\u53ef\u4ee5\u5bf9\u670d\u52a1\u5668\u7aef\u53e3\u9632\u706b\u5899\u3001\u7f51\u7ad9\u914d\u7f6e\u3001\u53cd\u5411\u4ee3\u7406\u3001https\u7b49\u4fe1\u606f\u8fdb\u884c\u53ef\u89c6\u5316\u914d\u7f6e\uff0c\u5bf9\u4e8elinux\u4e0d\u592a\u719f\u6089\u7684\u540c\u5b66\u4f1a\u6bd4\u8f83\u53cb\u597d\u3002<\/p>\n \u6211\u4e00\u5f00\u59cb\u5c31\u662f\u4f7f\u7528\u5b9d\u5854\u9762\u677f\u8fdb\u884c\u7ef4\u62a4\u7684\uff0c\u4f46\u662f\u5b9d\u5854\u662f\u95ed\u6e90\u7684\uff0c\u4e0d\u77e5\u9053\u5b89\u5168\u6027\u5982\u4f55\uff0c\u6240\u4ee5\u540e\u6765\u6211\u5c31\u4e0d\u518d\u4f7f\u7528\u4e86\uff0c\u76f4\u63a5\u4f7f\u7528linux\u5bf9nginx\u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n \u73af\u5883\u4f9d\u8d56<\/strong> \u56e0\u4e3a\u6bcf\u4e2a\u670d\u52a1\u53ef\u80fd\u4f9d\u8d56\u4e0d\u540c\u7684\u73af\u5883\u7248\u672c\uff0c\u800c\u8981\u4f7f\u51e0\u4e2a\u670d\u52a1\u4e4b\u95f4\u76f8\u4e92\u517c\u5bb9\uff0c\u6700\u597d\u7684\u89e3\u51b3\u529e\u6cd5\u53ef\u80fd\u5c31\u662f\u4f7f\u7528docker\u4e86\uff0c\u4e5f\u5c31\u662f\u6211\u4eec\u4e0a\u9762\u7528\u7684\u65b9\u6cd5\uff0c\u8fd9\u4e5f\u662f\u4e91\u539f\u751f\u4e2d\u5bb9\u5668\u5316\u7684\u65b9\u6848\u3002<\/p>\n \u9759\u6001NAT<\/strong> \u7531\u4e8e\u6211\u4eec\u5b9e\u9a8c\u5ba4\u7684\u670d\u52a1\u5668\u662f\u653e\u5728\u56fd\u5916\u7684\uff0c\u8bbf\u95ee\u6bd4\u8f83\u6162\uff0c\u6240\u4ee5\u6211\u5728\u8def\u7531\u5668\u4e2d\u6dfb\u52a0\u4e86\u9759\u6001NAT\uff0c\u8fd9\u6837\u4f7f\u7528\u6821\u56ed\u7f51\u8bbf\u95ee\u5c31\u5f88\u5feb\u4e86\u3002<\/p>\n \u6570\u636e\u5907\u4efd<\/strong> \u8be5yml\u6587\u4ef6\u5728wordpress\u5b98\u65b9\u7ed9\u7684demo\u57fa\u7840\u4e0a\uff0c\u5c06\u6302\u8f7d\u5377\u6539\u6210\u4e86\u6302\u8f7d\u4e3b\u673a\u76ee\u5f55\uff0c\u521b\u5efa\u4fee\u6539\u548c\u5907\u4efd\u8d77\u6765\u4f1a\u65b9\u4fbf\u4e00\u4e9b\uff1b\u5e76\u52a0\u5165\u4e86phpmyadmin\u955c\u50cf\uff0c\u53ef\u4ee5\u5bf9\u6570\u636e\u5e93\u8fdb\u884c\u53ef\u89c6\u5316\u64cd\u4f5c<\/p>\n \u7b49\u5f85docker\u542f\u52a8\u5b8c\u6210\u540e\uff0c\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165 \u8fd9\u4e00\u8282\u8bb2\u5982\u4f55\u4f7f\u7528https\u5bf9\u7f51\u7ad9\u8bbf\u95ee\u8fdb\u884c\u52a0\u5bc6\uff0c\u53ef\u4ee5\u5bf9\u7528\u6237\u7684\u8d26\u6237\u5bc6\u7801\u7b49\u6570\u636e\u8fdb\u884c\u52a0\u5bc6\uff0c\u9632\u6b62\u660e\u6587\u4f20\u8f93\u88ab\u7a83\u542c\u3002<\/p>\n https\u7684\u8bbf\u95ee\u6d41\u7a0b\u5982\u56fe\uff0c\u5173\u4e8ehttps\u66f4\u8be6\u7ec6\u7684\u539f\u7406\u53ef\u4ee5\u9605\u8bfb HTTPS\u8bf7\u6c42\u7684\u6574\u4e2a\u8fc7\u7a0b\u7684\u8be6\u7ec6\u5206\u6790<\/a> \u4f60\u9700\u8981\u6709\u4e00\u4e2a\u57df\u540d\uff0c\u6839\u636e\u8fd9\u4e2a\u57df\u540d\u53bb\u8bc1\u4e66\u9881\u53d1\u673a\u6784\u7533\u8bf7\u8bc1\u4e66\uff0c\u8fd9\u4efd\u8bc1\u4e66\u8bc1\u660e\u8fd9\u4e2a\u57df\u540d\u662f\u4f60\u7684\uff0c\u5305\u542b\u4e86\u5bc6\u94a5\u5bf9\u3002\u7533\u8bf7\u5230\u8bc1\u4e66\u4e4b\u540e\uff0c\u9700\u8981\u5c06\u5176\u90e8\u7f72\u5230\u4f60\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u5728\u6211\u4eec\u7684\u6848\u4f8b\u91cc\uff0c\u662f\u5c06\u5176\u90e8\u7f72\u5230nginx\u4e2d\u3002<\/p>\n \u7533\u8bf7\u7684\u6b65\u9aa4\u53ef\u4ee5\u4f7f\u7528acme.sh\u811a\u672c\uff0c\u8fd9\u4e2a\u811a\u672c\u53ef\u4ee5\u5b8c\u6210\u4ee5\u4e0b\u529f\u80fd\uff1a\u81ea\u52a8\u7533\u8bf7\u3001\u5230\u671f\u81ea\u52a8\u91cd\u65b0\u7533\u8bf7\u3001\u81ea\u52a8\u90e8\u7f72\u3002\u56e0\u4e3a\u514d\u8d39\u8bc1\u4e66\u662f\u6709\u671f\u9650\u7684\uff0c\u4e00\u822c\u662f90\u5929\uff0c\u6240\u4ee5\u5230\u671f\u9700\u8981\u91cd\u65b0\u7533\u8bf7\uff0cacme\u53ef\u4ee5\u81ea\u52a8\u5b8c\u6210\u3002<\/p>\n \u7533\u8bf7\u8fc7\u7a0bacme\u4f1a\u8ba9\u4f60\u8bc1\u660e\u8fd9\u4e2a\u57df\u540d\u662f\u4f60\u7684\uff0c\u6700\u7b80\u5355\u7684\u65b9\u5f0f\u662f\u901a\u8fc7DNS\u670d\u52a1\u5546\u7ed9\u7684api\u8fdb\u884c\u81ea\u52a8\u8ba4\u8bc1\uff0c\u8be6\u89c1acme\u4f7f\u7528dnsapi\u90e8\u7f72<\/a>\u3002<\/p>\n \u5173\u7cfbacme\u66f4\u591a\u7684\u4fe1\u606f\u548c\u7528\u6cd5\u53ef\u4ee5\u9605\u8bfb acme.sh<\/a><\/p>\n \u7533\u8bf7\u3001\u90e8\u7f72<\/strong><\/p>\n nginx\u914d\u7f6ehttps\u8bbf\u95ee<\/strong> \u5982\u679c\u4f60\u7684\u670d\u52a1\u662f\u90e8\u7f72\u5728\u672c\u5730\u4e3b\u673a\u4e0a\uff0c\u800c\u60f3\u8981\u5728\u5916\u7f51\u8fdb\u884c\u8bbf\u95ee\u3002<\/p>\n \u539f\u7406\u57fa\u672c\u90fd\u662f\u7b2c\u4e09\u65b9\u8f6c\u53d1\uff0c\u4e3b\u8981\u53ef\u4ee5\u5229\u7528\u7684\u5de5\u5177\u6709ssh\u3001frp\u3001\u9759\u6001NAT\u3002<\/p>\n ssh\u548cfrp<\/strong>\u7684\u539f\u7406\u662f\u7c7b\u4f3c\u7684\uff0c\u90fd\u662f\u5728\u4e91\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e00\u4e2a\u670d\u52a1\u7aefsshd\u6216frps\uff0c\u7136\u540e\u5728\u672c\u5730\u4e3b\u673a\u4e0a\u5b89\u88c5\u4e00\u4e2a\u5ba2\u6237\u7aefssh\u548cfrpc\u3002 \u9759\u6001NAT<\/strong>\u7684\u539f\u7406\u4e0e\u524d\u4e24\u4e2a\u4e0d\u592a\u4e00\u6837\uff0c\u610f\u601d\u5927\u6982\u662f\u5229\u7528\uff1a\u5f53\u4f60\u53d1\u9001\u6570\u636e\u5230\u53e6\u4e00\u4e2a\u7f51\u7edc\u65f6\uff0c\u8def\u7531\u5668\u4f1a\u628a\u4f60\u6570\u636e\u5305\u91cc\u9762\u7684ip:port\u6539\u6210\u8def\u7531\u5668\u81ea\u5df1\u7684ip:port\uff0c\u5982\u679c\u4f60\u7684\u8def\u7531\u5668\u5177\u6709\u516c\u7f51ip\uff0c\u90a3\u5c31\u53ef\u4ee5\u5728\u8def\u7531\u5668\u91cc\u9762\u6dfb\u52a0\u4e00\u6761\u9759\u6001NAT\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5916\u7f51\u8bbf\u95ee\u4e86\u3002<\/p>\n \u5b9e\u73b0ssh\u6620\u5c04 \u6d4b\u8bd5\u6709\u6ca1\u6709\u6210\u529f\uff0c\u5728\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u8fd0\u884c \u66f4\u591a\u5173\u4e8essh\uff0c\u8bf7\u9605\u8bfb \u8c03\u8bd5\u5229\u5668-SSH\u96a7\u9053<\/a><\/p>\n \u5efa\u8bae\uff1a\u4e0d\u8981\u7528\u5947\u5947\u602a\u602a\u7684\u7aef\u53e3\u76f4\u63a5\u8bbf\u95ee\u670d\u52a1\uff0c\u800c\u662f\u901a\u8fc7\u53cd\u5411\u4ee3\u7406\uff0c\u5168\u90e8\u6254\u5230HTTPS\uff08\u5982443\uff09\u4e0b\u9762<\/p>\n \u8fd9\u91cc\u63a8\u8350\u4e00\u4e9b\u642d\u5efa\u670d\u52a1\u5668\u8fc7\u7a0b\u4e2d\u6210\u4f53\u7cfb\u7684\u53c2\u8003\u8d44\u6599\u3002<\/p>\n \u5728\u670d\u52a1\u5668\u7684\u642d\u5efa\u4e2d\uff0c\u4e3b\u8981\u7528\u5230\u8ba1\u7b97\u673a\u7f51\u7edc\u3001linux\u7cfb\u7edf\u7ba1\u7406\u548c\u670d\u52a1\u5668\u7ef4\u62a4\u7684\u77e5\u8bc6\u3002<\/p>\n \u8ba1\u7b97\u673a\u7f51\u7edc\u53ef\u4ee5\u770b linux\u7cfb\u7edf\u7ba1\u7406\u548c\u670d\u52a1\u5668\u7ef4\u62a4\u53ef\u4ee5\u770b \u300a\u79c1\u623f\u83dc\u300b\u786e\u5b9e\u592a\u539a\u4e86\uff0c\u4e5f\u53ef\u4ee5\u5148\u4ece Linux\u5de5\u5177\u5feb\u901f\u6559\u7a0b<\/a> \u8fd9\u4e2a\u624b\u518c\u7b80\u5355\u4e86\u89e3linux\u7684\u57fa\u672c\u7528\u9014\u3002<\/p>\n
\n\u642d\u5efa\u7f51\u7ad9\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u5c31\u662f\u4f7f\u7528docker<\/strong>\u642d\u5efa\u3002<\/p>\n
\n\u56e0\u4e3adocker run wordpress\uff0c\u4f1a\u628a\u6570\u636e\u5e93\u548c\u670d\u52a1\u8026\u5408\u5728\u4e00\u8d77\uff0c\u4e4b\u540e\u4f60\u60f3\u8981\u628a\u6570\u636e\u6362\u4e2a\u786c\u76d8\u4fdd\u5b58\u8fd8\u4f1a\u6bd4\u8f83\u9ebb\u70e6\uff0c\u5e76\u4e14\u5982\u679c\u4f60\u60f3\u8981\u4f7f\u7528phpMyAdmin\u5bf9\u6570\u636e\u5e93\u53ef\u89c6\u5316\u64cd\u4f5c\uff0c\u8fd9\u4e2a\u65f6\u5019\u4f7f\u7528docker run\u5c31\u96be\u4ee5\u5b9e\u73b0\u4e86\u3002<\/p>\n<\/span>2\u3001\u5916\u7f51\u8bbf\u95ee<\/span><\/h4>\n
\n\u56e0\u4e3assh\u76f8\u5f53\u4e8e\u672c\u5730\u4e3b\u673a\u5bf9\u516c\u7f51\u4e3b\u673a\u5efa\u7acb\u8fde\u63a5\uff0c\u6240\u4ee5\u672c\u5730\u4e3b\u673a\u6bcf\u6b21\u5f00\u673a\u6216\u8005\u7f51\u7edc\u91cd\u8fde\u4e4b\u540e\u90fd\u9700\u8981\u91cd\u65b0\u4e3b\u52a8\u8fde\u63a5\u516c\u7f51\u4e3b\u673a\u3002\u90a3\u4e48\u5982\u4f55\u5b9e\u73b0\u5f00\u673a\u81ea\u52a8\u8fde\u63a5\uff1f\u5c31\u9700\u8981\u5199\u4e00\u4efdservice\u6587\u4ef6\uff0c\u4f7f\u7528systemctl\u547d\u4ee4\uff0c\u8ba9linux\u6bcf\u6b21\u542f\u52a8\u65f6\u6267\u884c\u4f60\u7684\u547d\u4ee4\u3002<\/p>\n<\/span>3\u3001\u5176\u4ed6\u5b8c\u5584<\/span><\/h4>\n
\n\u4e0a\u9762\u7684\u6b65\u9aa4\u4e2d\uff0c\u6211\u4eec\u90fd\u662f\u4f7f\u7528ip:port\u8fdb\u884c\u8bbf\u95ee\uff0c\u90a3\u4e48\u5982\u4f55\u4f7f\u7528 www.yoursite.com \u8fd9\u6837\u7684\u5f62\u5f0f\u8fdb\u884c\u8bbf\u95ee\u5462\uff1f\u9700\u8981\u4f60\u53bb\u57df\u540d\u5546\u90a3\u91cc\u8d2d\u4e70\u57df\u540d\uff0c\u7136\u540e\u5728\u4ed6\u7684dns\u670d\u52a1\u5668\u4e0a\u628a\u57df\u540d\u6307\u5411\u4f60\u7684\u516c\u7f51ip\uff1b\u540c\u65f6\uff0c\u4e5f\u9700\u8981\u4f7f\u7528nginx\u53cd\u4ee3\uff0c\u4e3a\u57df\u540d\u63d0\u4f9b\u76f8\u5e94\u7684\u670d\u52a1\u3002<\/p>\n
\n\u7531\u4e8ehttp\u4f7f\u7528\u660e\u6587\u4f20\u8f93\uff0c\u800c\u7528\u6237\u767b\u5f55\u5bc6\u7801\u7b49\u4fe1\u606f\u7528\u660e\u6587\u4f20\u8f93\u80af\u5b9a\u662f\u4e0d\u5b89\u5168\u7684\uff0c\u5982\u4f55\u4f7f\u7528\u8fdb\u884c\u52a0\u5bc6\u4f20\u8f93\uff1f\u8fd9\u4e2a\u65f6\u5019\u5c31\u9700\u8981\u628a\u4f60\u7684\u7f51\u7ad9\u5347\u7ea7\u5230\u7528https\u8bbf\u95ee\uff0c\u9700\u8981\u4f7f\u7528\u5230acme.sh\u811a\u672c\u8fdb\u884c\u90e8\u7f72\u3002<\/p>\n
\n\u5982\u679c\u6211\u4e0d\u6b62\u6709wordpress\u670d\u52a1\uff0c\u6211\u8fd8\u6709nextcloud\u3001gitea\u7b49\uff0c\u90a3\u6211\u662f\u5426\u9700\u8981\u5bf9\u6bcf\u4e2a\u670d\u52a1\u7aef\u53e3\u90fd\u8fdb\u884c\u7a7f\u900f\uff1f\u6b64\u65f6\u53ef\u4ee5\u4f7f\u7528nginx\u53cd\u5411\u4ee3\u7406\uff0c\u6bd4\u5982\u8ba9nginx\u76d1\u542c8080\u7aef\u53e3\uff0c\u7136\u540e\u518d\u6839\u636e\u7528\u6237\u8bbf\u95ee\u7684\u57df\u540d\uff0c\u53cd\u4ee3\u5230\u76f8\u5e94\u7684\u670d\u52a1\u7aef\u53e3\u3002<\/p>\n
\n\u4e00\u822c\u8fd0\u884cweb\u670d\u52a1\u9700\u8981LNMP\u6216\u8005LAMP\u73af\u5883\uff0c\u5373Linux+Nginx+Mysql+php\uff0c\u6216Apache\u3002php\u7528\u6765\u8fd0\u884c\u4f60\u7684\u670d\u52a1\u4ee3\u7801\uff0cMysql\u7528\u6765\u88c5\u6570\u636e\uff0cNginx\u7528\u6765\u505a\u53cd\u5411\u4ee3\u7406\u3001\u8d1f\u8f7d\u5747\u8861\u7b49\u3002<\/p>\n
\n\u5728\u524d\u9762\u505a\u5185\u7f51\u7a7f\u900f\u7684\u6b65\u9aa4\uff0c\u5982\u679c\u4f60\u7684\u8def\u7531\u5668\u5177\u6709\u516c\u7f51ip\uff0c\u4e5f\u53ef\u4ee5\u5728\u8def\u7531\u5668\u4e0a\u6dfb\u52a0\u4e00\u4e2a\u9759\u6001NAT\u914d\u7f6e\u6765\u5b9e\u73b0\u3002<\/p>\n
\n\u53ef\u4ee5\u4f7f\u7528sh\u811a\u672c\u548ccrontab\u5b9a\u65f6\u6267\u884c<\/p>\n<\/span>\u4e09\u3001\u5728\u672c\u5730\/\u4e91\u4e3b\u673a\u4e0a\u642d\u5efawordpress<\/span><\/h3>\n
# \u5b89\u88c5docker\u548cdocker-compose\n\n# \u53bb\u5230\u4f60\u60f3\u5b58\u653e\u6570\u636e\u7684\u4f4d\u7f6e\ncd pathtoinstall\n\n# \u521b\u5efa\u6587\u4ef6\u5939\u6765\u50a8\u5b58wordpress\u6587\u4ef6\u3001\u6570\u636e\u5e93\nmkdir -p wordpress\/wp wordpress\/db\n\n# \u521b\u5efadocker-compose.yml\ncd wordpress\ntouch docker-compose.yml\nvim docker-compose.yml\n\n# \u5c06demo\u5185\u5bb9\u590d\u5236\u5230docker-compose.yml\u4e2d\uff0c\u4fdd\u5b58\u5e76\u9000\u51fa<\/code><\/pre>\n
# docker-compose.yml demo\n\nversion: '3.1'\n\nservices:\n wordpress:\n image: wordpress\n restart: always\n ports:\n - 8080:80\n environment:\n WORDPRESS_DB_HOST: db\n WORDPRESS_DB_USER: exampleuser\n WORDPRESS_DB_PASSWORD: examplepass\n WORDPRESS_DB_NAME: exampledb\n volumes:\n - .\/wp:\/var\/www\/html\n\n db:\n image: mysql:5.7\n restart: always\n environment:\n MYSQL_DATABASE: exampledb\n MYSQL_USER: exampleuser\n MYSQL_PASSWORD: examplepass\n MYSQL_RANDOM_ROOT_PASSWORD: '1'\n volumes:\n - .\/db:\/var\/lib\/mysql\n\n phpmyadmin:\n image: phpmyadmin\n restart: always\n ports:\n - 8081:80\n environment:\n MYSQL_ROOT_PASSWORD: examplepass\n PMA_HOST: db\n PMA_PORT: 3306\n depends_on:\n - db<\/code><\/pre>\n
# \u542f\u52a8docker-compose\ndocker-compose up<\/code><\/pre>\n
ip:8080<\/code>\u5c31\u53ef\u4ee5\u8fdb\u884c\u8bbf\u95ee\u5566<\/p>\n
<\/span>\u56db\u3001\u90e8\u7f72https<\/span><\/h3>\n
\n<\/p>\n<\/span>1\u3001\u90e8\u7f72\u903b\u8f91<\/span><\/h4>\n
<\/span>2\u3001\u8be6\u7ec6\u6b65\u9aa4<\/span><\/h4>\n
# \u5207\u6362\u4e3aroot\u7528\u6237\u8fd0\u884c\uff0c\u540e\u9762\u7684\u90e8\u7f72\u4f1a\u65b9\u4fbf\u5f88\u591a\nsudo su root\n\n# \u4e0b\u8f7d\u811a\u672c\ncurl https:\/\/get.acme.sh\n\n# \u53bb\u5bf9\u5e94\u7684DNS\u670d\u52a1\u5546\u83b7\u53d6\uff0c\u5982\u679c\u7528\u963f\u91cc\u4e91\u7684\u5b50\u8d26\u6237\uff0c\u90a3\u5c31\u9700\u8981\u5f00\u901a\u5b50\u7528\u6237\u7684dns\u7ba1\u7406\u6743\u9650\n# \u53c2\u8003 https:\/\/www.jianshu.com\/p\/012b1eb233f7\nexport Ali_Key="xxx"\nexport Ali_Secret="xxx"\n\n# \u7533\u8bf7\u8bc1\u4e66\nacme.sh --issue --dns dns_ali -d naturalbase.cn -d *.naturalbase.cn\n\n# \u5b89\u88c5\u8bc1\u4e66\u5230nginx\uff0c\u6bcf\u6b21\u66f4\u65b0\u8bc1\u4e66\u65f6\uff0c\u4f1a\u81ea\u52a8\u91cd\u65b0\u90e8\u7f72\u3002\nmkdir -p \/etc\/nginx\/ssl\/naturalbase.cn\/\nacme.sh --install-cert -d naturalbase.cn \n--key-file \/etc\/nginx\/ssl\/naturalbase.cn\/key.pem \n--fullchain-file \/etc\/nginx\/ssl\/naturalbase.cn\/cert.pem \n--reloadcmd "service nginx force-reload"\n<\/code><\/pre>\n
\n\u4e0a\u9762\u7684\u6b65\u9aa4\u53ea\u662f\u5b9e\u73b0\u628a\u8bc1\u4e66\u653e\u5230nginx\u76ee\u5f55\uff0c\u4e0b\u9762\u8fd8\u9700\u8981\u914d\u7f6enginx\uff0c\u8ba9\u4f60\u7684\u7f51\u7ad9\u652f\u6301https<\/p>\n# \u6253\u5f00\u4f60\u7684\u7f51\u7ad9\u914d\u7f6e\u6587\u4ef6\uff0c\u5982 \/etc\/nginx\/conf.d\/naturalbase.conf\n\nvim \/etc\/nginx\/conf.d\/naturalbase.conf\n\n# \u590d\u5236\u4e0b\u9762\u7684demo\u5230\u6587\u4ef6\u91cc\n<\/code><\/pre>\n
server {\n listen 80;\n listen [::]:80;\n server_name www.naturalbase.cn naturalbase.cn;\n # SSL-START SSL\u76f8\u5173\u914d\u7f6e\n #error_page 404\/404.html;\n # HTTP_TO_HTTPS_END \u5f3a\u5236\u5f00\u542fhttps\n if ($server_port !~ 443){\n rewrite ^(\/.*)$ https:\/\/$host$1 permanent;\n }\n # HTTP_TO_HTTPS_END\n listen 443 ssl;\n ssl_certificate \/etc\/nginx\/ssl\/naturalbase.cn\/cert.pem;\n ssl_certificate_key \/etc\/nginx\/ssl\/naturalbase.cn\/key.pem;\n ssl_buffer_size 16k;\n ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;\n ssl_session_timeout 3h;\n ssl_stapling on;\n ssl_session_tickets on;\n # SSL-END\n # \u53cd\u5411\u4ee3\u7406\u914d\u7f6e\n location ~* .(gif|png|jpg|css|js|woff|woff2)$\n {\n proxy_pass http:\/\/127.0.0.1:9500;\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header REMOTE-HOST $remote_addr;\n expires 12h;\n }\n location \/ {\n proxy_pass http:\/\/127.0.0.1:9500;\n index index.html index.htm;\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header REMOTE-HOST $remote_addr;\n\n add_header X-Cache $upstream_cache_status;\n\n #Set Nginx Cache\n add_header Cache-Control no-cache;\n }\n # END \u53cd\u5411\u4ee3\u7406\u914d\u7f6e\n }<\/code><\/pre>\n
<\/span>\u4e94\u3001\u5185\u7f51\u7a7f\u900f<\/span><\/h3>\n
\n\u5ba2\u6237\u7aeffrpc\u544a\u8bc9\u670d\u52a1\u5668frps\u53bb\u76d1\u542c\u4e91\u670d\u52a1\u5668\u7684\u67d0\u4e2a\u7aef\u53e3\uff0c\u8fd9\u4e2a\u7aef\u53e3\u662f\u4f60\u7528\u6765\u8bbf\u95ee\u670d\u52a1\u7684\u7aef\u53e3\uff0c\u7136\u540e\u5c06\u8fd9\u4e2a\u7aef\u53e3\u6536\u5230\u7684\u6570\u636e\u8f6c\u53d1\u7ed9frpc\uff0cfrpc\u518d\u8f6c\u53d1\u7ed9\u4f60\u7684\u672c\u5730\u670d\u52a1\u7aef\u53e3\uff0c\u4ee5\u6b64\u6765\u5b9e\u73b0\u8f6c\u53d1\u7684\u529f\u80fd\u3002
\n\u4f46frp\u662f\u57fa\u4e8e\u5f31\u53e3\u4ee4\u5bc6\u7801\uff0c\u5b89\u5168\u6027\u8f83\u4f4e\uff0c\u6240\u4ee5\u4e00\u822c\u6211\u90fd\u662f\u7528ssh\uff0c\u800c\u4e14ssh\u66f4\u7b80\u5355\uff0c\u53ea\u9700\u8981\u4e00\u884c\u547d\u4ee4\u5c31\u884c\u4e86\u3002<\/p>\n
\n\u7528\u5230\u7684\u547d\u4ee4\uff1a
\nssh -NTf -R \u8fdc\u7a0b\u7aef\u53e3:\u76ee\u6807\u5730\u5740:\u76ee\u6807\u7aef\u53e3 \u7528\u6237@\u516c\u7f51ip
\n\u5982\uff1a
\nssh -NTf -R 12345:localhost:3000 root@47.106.xx.xx<\/code>
\n\u8fd9\u53e5\u8bdd\u5c31\u5c06\u672c\u5730\u4e3b\u673a\u76843000\u7aef\u53e3\u6620\u5c04\u4e3a\u8fdc\u7a0b\u4e3b\u673a\u7684localhost:12345\u7aef\u53e3\uff0c\u5f53\u4f60\u8bbf\u95ee47.106.xx.xx:12345\u7aef\u53e3\u65f6\uff0c\u5c31\u8bbf\u95ee\u5230\u4e86\u672c\u5730\u4e3b\u673a\u76843000\u7aef\u53e3\u3002<\/p>\nnetstat -ntlp | grep 12345<\/code>\uff0c\u6709\u7684\u8bdd\u4f1a\u6709\u6b63\u786e\u7684\u5730\u5740:\u7aef\u53e3<\/p>\n
<\/span>\u516d\u3001\u53c2\u8003\u6587\u732e<\/span><\/h3>\n
\u300a\u56fe\u89e3TCP\/IP\u300b<\/code>\u8fd9\u672c\u4e66\uff0c\u5185\u5bb9\u7cbe\u7b80\u5b9e\u7528\uff0c\u4e5f\u6bd4\u8c22\u5e0c\u4ec1\u7684\u300a\u8ba1\u7b97\u673a\u7f51\u7edc\u300b\u5bb9\u6613\u7406\u89e3\u3002<\/p>\n
\u300a\u9e1f\u54e5\u7684linux\u79c1\u623f\u83dc \u57fa\u7840\u7bc7\u300b<\/code>\u8fd9\u672c\u4e66\uff0c\u6bd4\u8f83\u539a\uff0c\u53ef\u4ee5\u5148\u770b\u6bcf\u7ae0\u7684\u5c0f\u7ed3\uff0c\u9047\u5230\u611f\u5174\u8da3\u7684\u518d\u8be6\u7ec6\u770b\u5185\u5bb9\u3002<\/p>\n