{"id":7655,"date":"2025-12-09T12:30:29","date_gmt":"2025-12-09T04:30:29","guid":{"rendered":"https:\/\/www.xinyixx.com\/?p=7655"},"modified":"2025-12-09T12:30:29","modified_gmt":"2025-12-09T04:30:29","slug":"kaifa","status":"publish","type":"post","link":"https:\/\/www.xinyixx.com\/index.php\/2025\/12\/09\/kaifa\/","title":{"rendered":"\u4e00\u4e2a\u9879\u76ee\u4ece 0 \u5230\u4e0a\u7ebf\u7684\u6280\u672f\u8def\u7ebf\u56fe"},"content":{"rendered":"<h1>\ud83d\ude80 <strong>\u4e00\u3001\u786e\u5b9a\u9879\u76ee\u57fa\u7840\uff08\u65b9\u5411\u3001\u6280\u672f\u3001\u7ed3\u6784\uff09<\/strong><\/h1>\n<p>\u4f60\u8981\u56de\u7b54 3 \u4e2a\u6838\u5fc3\u95ee\u9898\uff1a<\/p>\n<h2><strong>\u2460 \u9879\u76ee\u662f\u4ec0\u4e48\uff1f\uff08\u4e1a\u52a1\u76ee\u6807\uff09<\/strong><\/h2>\n<p>\u5982\uff1a<\/p>\n<ul>\n<li>\u4f01\u4e1a\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf<\/li>\n<li>\u6570\u636e\u53ef\u89c6\u5316\u5e73\u53f0<\/li>\n<li>\u5c0f\u7a0b\u5e8f\u540e\u53f0<\/li>\n<li>AI \u63a5\u5165\u7cfb\u7edf\uff08OpenAI \/ DeepSeek\uff09<\/li>\n<li>\u9759\u6001\u5b98\u7f51<\/li>\n<\/ul>\n<h2><strong>\u2461 \u7528\u4ec0\u4e48\u6280\u672f\uff1f\uff08\u524d\u7aef + \u540e\u7aef + \u6570\u636e\u5e93\uff09<\/strong><\/h2>\n<p>\u5efa\u8bae\u7ec4\u5408\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u524d\u7aef<\/th>\n<th>\u540e\u7aef<\/th>\n<th>\u6570\u636e\u5e93<\/th>\n<th>\u9002\u7528\u573a\u666f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Vue3 + Vite<\/td>\n<td>Node.js + Express<\/td>\n<td>MySQL<\/td>\n<td>\u540e\u53f0\u7cfb\u7edf\u3001\u4e1a\u52a1\u7cfb\u7edf<\/td>\n<\/tr>\n<tr>\n<td>React + Vite<\/td>\n<td>NestJS<\/td>\n<td>PostgreSQL<\/td>\n<td>\u5927\u578b\u540e\u53f0\u3001\u590d\u6742\u4e1a\u52a1<\/td>\n<\/tr>\n<tr>\n<td>Vue3<\/td>\n<td>Python + Django<\/td>\n<td>MySQL<\/td>\n<td>\u7ba1\u7406\u540e\u53f0\u3001\u4f01\u4e1a\u5185\u90e8\u7cfb\u7edf<\/td>\n<\/tr>\n<tr>\n<td>\u9759\u6001 HTML<\/td>\n<td>\u65e0<\/td>\n<td>\u65e0<\/td>\n<td>\u5b98\u7f51\u7c7b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><strong>\u2462 \u9879\u76ee\u7ed3\u6784<\/strong><\/h2>\n<p>\u6700\u5e38\u89c1\u7ed3\u6784\uff1a<\/p>\n<pre><code>project\/\n\u251c\u2500\u2500 frontend\/     # Vue\/React\n\u2514\u2500\u2500 backend\/      # Node\/Django\/Flask<\/code><\/pre>\n<hr \/>\n<h1>\ud83d\ude80 <strong>\u4e8c\u3001\u642d\u5efa\u5f00\u53d1\u73af\u5883\uff08\u672c\u5730\u73af\u5883\uff09<\/strong><\/h1>\n<h2><strong>\u524d\u7aef\uff08Vue \/ React\uff09<\/strong><\/h2>\n<pre><code class=\"language-bash\">npm create vite@latest frontend\ncd frontend\nnpm install\nnpm run dev<\/code><\/pre>\n<h2><strong>\u540e\u7aef\uff08Node \u793a\u4f8b\uff09<\/strong><\/h2>\n<pre><code class=\"language-bash\">mkdir backend\ncd backend\nnpm init -y\nnpm install express<\/code><\/pre>\n<p>\u5efa\u7acb\u57fa\u672c\u63a5\u53e3\uff1a<\/p>\n<pre><code class=\"language-js\">const app = require('express')()\n\napp.get('\/api\/test', (req, res) =&gt; {\n  res.json({ msg: 'ok' })\n})\n\napp.listen(3000)<\/code><\/pre>\n<h2><strong>\u540e\u7aef\uff08Django \u793a\u4f8b\uff09<\/strong><\/h2>\n<pre><code class=\"language-bash\">pip install django\ndjango-admin startproject backend\npython manage.py runserver 0.0.0.0:8000<\/code><\/pre>\n<hr \/>\n<h1>\ud83d\ude80 <strong>\u4e09\u3001\u8054\u8c03\uff08\u524d\u540e\u7aef\u8fde\u63a5\uff09<\/strong><\/h1>\n<p>\u524d\u7aef\u914d\u7f6e API \u5730\u5740\uff08proxy \u6216 env\uff09\uff1a<\/p>\n<h3>Vue \/ Vite<\/h3>\n<pre><code class=\"language-js\">\/\/ vite.config.js\nserver: {\n  proxy: {\n    '\/api': 'http:\/\/localhost:3000'\n  }\n}<\/code><\/pre>\n<hr \/>\n<h1>\ud83d\ude80 <strong>\u56db\u3001\u529f\u80fd\u5f00\u53d1\uff08\u6838\u5fc3\u5f00\u53d1\u9636\u6bb5\uff09<\/strong><\/h1>\n<p>\u6b63\u5e38\u6309\u6a21\u5757\u8fed\u4ee3\uff1a<\/p>\n<p>\u2714 \u767b\u5f55\/\u6743\u9650<br \/>\n\u2714 \u9875\u9762\u5e03\u5c40<br \/>\n\u2714 CRUD \u9875\u9762<br \/>\n\u2714 \u65e5\u5fd7\u7cfb\u7edf<br \/>\n\u2714 \u6587\u4ef6\u4e0a\u4f20<br \/>\n\u2714 \u62a5\u8868\u56fe\u8868<br \/>\n\u2714 \u6570\u636e\u5e93\u8868\u8bbe\u8ba1<\/p>\n<p>\u5fc5\u5907\u5de5\u5177\uff1a<\/p>\n<ul>\n<li>Git\uff08\u7248\u672c\u63a7\u5236\uff09<\/li>\n<li>Postman \/ Apifox\uff08\u63a5\u53e3\u8c03\u8bd5\uff09<\/li>\n<li>Docker\uff08\u51c6\u5907\u4e0a\u7ebf\uff09<\/li>\n<\/ul>\n<hr \/>\n<h1>\ud83d\ude80 <strong>\u4e94\u3001\u6784\u5efa\u4e0a\u7ebf\u7248\u672c\uff08\u751f\u4ea7\u73af\u5883\uff09<\/strong><\/h1>\n<h3>\u524d\u7aef\u6784\u5efa<\/h3>\n<pre><code>cd frontend\nnpm run build<\/code><\/pre>\n<p>\u751f\u6210\uff1a<\/p>\n<pre><code>dist\/<\/code><\/pre>\n<h3>\u540e\u7aef\u51c6\u5907<\/h3>\n<ul>\n<li>Node \u90e8\u7f72\u7528 <code>pm2<\/code><\/li>\n<li>Django \u90e8\u7f72\u7528 <code>gunicorn + nginx<\/code><\/li>\n<\/ul>\n<hr \/>\n<h1>\ud83d\ude80 <strong>\u516d\u3001\u670d\u52a1\u5668\u90e8\u7f72\uff08Windows Server \/ Linux \u90fd\u652f\u6301\uff09<\/strong><\/h1>\n<h2>\u2b50\u7b2c\u4e00\u79cd\uff1aWindows Server \u7684\u63a8\u8350\u90e8\u7f72\u65b9\u5f0f<\/h2>\n<h3>\u2460 \u5b89\u88c5 Nginx<\/h3>\n<p>\u7528\u4e8e\u53cd\u5411\u4ee3\u7406 + \u63d0\u4f9b HTTPS + \u591a\u9879\u76ee\u7aef\u53e3\u5206\u6d41\u3002<\/p>\n<h3>\u2461 \u5b89\u88c5 Node.js \/ Python \u73af\u5883<\/h3>\n<h3>\u2462 \u5b89\u88c5 PM2\uff08\u7ba1\u7406\u591a\u4e2a\u9879\u76ee\uff09<\/h3>\n<pre><code>npm install pm2 -g<\/code><\/pre>\n<h3>\u2463 \u542f\u52a8\u591a\u4e2a\u540e\u7aef\u9879\u76ee<\/h3>\n<pre><code>pm2 start backend1\/app.js --name app1\npm2 start backend2\/app.js --name app2\npm2 start backend3\/app.js --name app3<\/code><\/pre>\n<h3>\u2464 Nginx \u591a\u9879\u76ee\u914d\u7f6e\uff08\u793a\u4f8b\uff09<\/h3>\n<pre><code>server {\n    listen 80;\n    server_name example.com;\n\n    location \/ {\n        root D:\/project\/frontend\/dist;\n        try_files $uri \/index.html;\n    }\n\n    location \/api\/ {\n        proxy_pass http:\/\/127.0.0.1:3000\/;\n    }\n}<\/code><\/pre>\n<p>\u2714 \u5c06\u591a\u4e2a\u7aef\u53e3\u6574\u5408\u5230 Nginx<br \/>\n\u2714 \u4e00\u4e2a\u57df\u540d\u5373\u53ef\u8bbf\u95ee<br \/>\n\u2714 Windows Server \u5b8c\u7f8e\u9002\u914d<\/p>\n<hr \/>\n<h1>\ud83d\ude80 <strong>\u4e03\u3001\u4f7f\u7528 Docker\uff08\u66f4\u9ad8\u7ea7\u66f4\u901a\u7528\uff09<\/strong><\/h1>\n<p>Docker \u53ef\u4ee5\u628a\u524d\u7aef\u3001\u540e\u7aef\u3001\u6570\u636e\u5e93\u5168\u90e8\u6253\u5305\u3002<\/p>\n<h3>\u524d\u7aef<\/h3>\n<pre><code>docker build -t my-frontend .\/frontend\ndocker run -p 80:80 my-frontend<\/code><\/pre>\n<h3>\u540e\u7aef<\/h3>\n<pre><code>docker build -t my-backend .\/backend\ndocker run -p 3000:3000 my-backend<\/code><\/pre>\n<h3>\u6570\u636e\u5e93<\/h3>\n<pre><code>docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql<\/code><\/pre>\n<p>\u751f\u4ea7\u7528 <code>docker-compose.yml<\/code> \u7ba1\u7406\u591a\u4e2a\u670d\u52a1\u3002<\/p>\n<hr \/>\n<h1>\ud83d\ude80 <strong>\u516b\u3001\u4e0a HTTPS\uff08\u5fc5\u987b\uff09<\/strong><\/h1>\n<p>\u4f7f\u7528 Certbot \u6216 Win-ACME<br \/>\nWindows Server \u63a8\u8350\uff1a<\/p>\n<pre><code>win-acme --target manual --host your-domain.com<\/code><\/pre>\n<p>Nginx \u914d\u7f6e SSL\uff1a<\/p>\n<pre><code>listen 443 ssl;\nssl_certificate \/path\/fullchain.pem;\nssl_certificate_key \/path\/privkey.pem;<\/code><\/pre>\n<hr \/>\n<h1>\ud83d\ude80 <strong>\u4e5d\u3001\u4e0a\u7ebf\u540e\u76d1\u63a7\uff08\u8fd0\u7ef4\u9636\u6bb5\uff09<\/strong><\/h1>\n<h3>\u5fc5\u5907\u76d1\u63a7\u5185\u5bb9\uff1a<\/h3>\n<ul>\n<li>PM2 \u65e5\u5fd7<\/li>\n<li>Nginx \u65e5\u5fd7<\/li>\n<li>CPU \u5185\u5b58\u76d1\u63a7<\/li>\n<li>\u6570\u636e\u5e93\u6027\u80fd<\/li>\n<li>API \u54cd\u5e94\u65f6\u95f4<\/li>\n<\/ul>\n<h3>\u5de5\u5177\uff1a<\/h3>\n<ul>\n<li>PM2 Dashboard\uff08\u53ef\u89c6\u5316\uff09<\/li>\n<li>Nginx \u53ef\u89c6\u5316\u5de5\u5177<\/li>\n<li>Prometheus + Grafana<\/li>\n<li>Windows \u6027\u80fd\u76d1\u63a7\u5668\uff08PerfMon\uff09<\/li>\n<\/ul>\n<hr \/>\n<h1>\ud83d\ude80 <strong>\u5341\u3001\u6301\u7eed\u96c6\u6210 CI\/CD\uff08\u53ef\u9009\u4f46\u63a8\u8350\uff09<\/strong><\/h1>\n<p>\u81ea\u52a8\u90e8\u7f72\u6d41\u7a0b\uff1a<\/p>\n<ul>\n<li>GitHub Actions<\/li>\n<li>GitLab CI<\/li>\n<li>Jenkins<\/li>\n<li>Gitea + Drone\uff08\u5185\u7f51\u9002\u7528\uff09<\/li>\n<\/ul>\n<p>\u4f8b\u5982 push \u540e\u81ea\u52a8\uff1a<br \/>\n\u2714 \u6784\u5efa\u524d\u7aef<br \/>\n\u2714 \u90e8\u7f72\u524d\u7aef\u5230 Nginx<br \/>\n\u2714 \u91cd\u542f PM2<br \/>\n\u2714 \u6570\u636e\u5907\u4efd<\/p>\n<hr \/>\n<h1>\ud83d\udd25 \u3010\u6700\u7ec8\u6548\u679c\uff1a\u4e00\u4e2a\u9879\u76ee\u4ece\u96f6\u5230\u4e0a\u7ebf\u3011<\/h1>\n<p>\u4f60\u5c06\u5b8c\u6210\uff1a<\/p>\n<h3>\u2714 \u5f00\u53d1\u73af\u5883\u642d\u5efa<\/h3>\n<h3>\u2714 \u524d\u7aef + \u540e\u7aef\u9879\u76ee\u521b\u5efa<\/h3>\n<h3>\u2714 API \u8054\u8c03<\/h3>\n<h3>\u2714 \u524d\u7aef\u6784\u5efa<\/h3>\n<h3>\u2714 \u540e\u7aef\u90e8\u7f72\uff08PM2 \/ Gunicorn\uff09<\/h3>\n<h3>\u2714 Nginx \u53cd\u5411\u4ee3\u7406<\/h3>\n<h3>\u2714 HTTPS<\/h3>\n<h3>\u2714 \u591a\u9879\u76ee\u7aef\u53e3\u7edf\u4e00\u7ba1\u7406<\/h3>\n<h3>\u2714 Docker \u5316<\/h3>\n<h3>\u2714 \u76d1\u63a7\u4e0e\u65e5\u5fd7<\/h3>\n<h3>\u2714 \u81ea\u52a8\u90e8\u7f72<\/h3>\n<hr \/>\n<h1>\u5982\u679c\u4f60\u613f\u610f\uff0c\u6211\u8fd8\u80fd\u7ee7\u7eed\u7ed9\u4f60\u505a\ud83d\udc47<\/h1>\n<h3>\u2713 \u53ef\u6253\u5370\u7684\u300a\u4ece0\u5230\u4e0a\u7ebf\u8def\u7ebf\u56fe PDF\u300b<\/h3>\n<h3>\u2713 Windows Server \u591a\u9879\u76ee\u90e8\u7f72\u5b8c\u6574\u811a\u672c<\/h3>\n<h3>\u2713 Vue + Node + Nginx \u7684\u4e00\u952e\u90e8\u7f72\u6a21\u677f<\/h3>\n<h3>\u2713 \u7ed9\u4f60\u7684\u771f\u5b9e\u9879\u76ee\u505a\u201c\u91cf\u8eab\u5b9a\u5236\u7684\u4e0a\u7ebf\u8def\u7ebf\u56fe\u201d<\/h3>\n<p>\u544a\u8bc9\u6211\u4f60\u5e0c\u671b\u54ea\u4e00\u79cd\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\ude80 \u4e00\u3001\u786e\u5b9a\u9879\u76ee\u57fa\u7840\uff08\u65b9\u5411\u3001\u6280\u672f\u3001\u7ed3\u6784\uff09 \u4f60\u8981\u56de\u7b54 3 \u4e2a\u6838\u5fc3\u95ee\u9898\uff1a \u2460 \u9879\u76ee\u662f\u4ec0\u4e48\uff1f\uff08\u4e1a\u52a1\u76ee\u6807\uff09 \u5982\uff1a \u4f01\u4e1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[6,14],"tags":[],"class_list":["post-7655","post","type-post","status-publish","format-standard","hentry","category-build","category-teacher","entry"],"_links":{"self":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts\/7655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/comments?post=7655"}],"version-history":[{"count":1,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts\/7655\/revisions"}],"predecessor-version":[{"id":7658,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts\/7655\/revisions\/7658"}],"wp:attachment":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/media?parent=7655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/categories?post=7655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/tags?post=7655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}