{"id":14785,"date":"2025-04-18T21:27:19","date_gmt":"2025-04-18T13:27:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/14785.html"},"modified":"2025-04-18T21:27:19","modified_gmt":"2025-04-18T13:27:19","slug":"%e9%83%a8%e7%bd%b2next-js%e5%ba%94%e7%94%a8%e8%af%a6%e7%bb%86%e6%8c%87%e5%8d%97%ef%bc%9a%e5%9c%a8-linux-%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e4%bd%bf%e7%94%a8-nginx%e3%80%81pm2%e3%80%81certbot","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/14785.html","title":{"rendered":"\u90e8\u7f72Next.js\u5e94\u7528\u8be6\u7ec6\u6307\u5357\uff1a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git"},"content":{"rendered":"<p>\u5047\u8bbe\u4f60\u5df2\u7ecf\u6784\u5efa\u4e86\u4e00\u4e2a Next.js \u5e94\u7528&#xff0c;\u73b0\u5728\u60f3\u8981\u5c06\u5176\u90e8\u7f72\u5230 Linux \u670d\u52a1\u5668\u4e0a\u3002\u6211\u5c06\u5f15\u5bfc\u4f60\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u3002 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418132718-68025336125b6.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u9996\u5148&#xff0c;\u4f60\u9700\u8981\u786e\u4fdd\u4f60\u7684\u670d\u52a1\u5668\u5df2\u5b89\u88c5 Nginx\u3002<\/p>\n<p>\u5982\u679c\u6ca1\u6709&#xff0c;\u4f60\u53ef\u4ee5\u4f7f\u7528\u51e0\u4e2a\u7b80\u5355\u7684\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002\u5b8c\u6210\u540e&#xff0c;\u4f60\u9700\u8981\u4e3a\u5e94\u7528\u8bbe\u7f6e\u4e00\u4e2a\u57df\u540d\u3002\u4f60\u53ef\u4ee5\u4ece\u57df\u540d\u6ce8\u518c\u5546\u5904\u8d2d\u4e70\u57df\u540d&#xff0c;\u4e5f\u53ef\u4ee5\u4f7f\u7528\u514d\u8d39\u57df\u540d\u63d0\u4f9b\u5546&#xff08;\u5982 Freenom&#xff09;\u3002\u5728\u4f60\u7684\u670d\u52a1\u5668\u4e0a&#xff0c;\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 nginx&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt-get<\/span> update<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt-get<\/span> <span class=\"token function\">install<\/span> nginx<\/p>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u4f7f\u7528 Git \u5c06 Next.js \u5e94\u7528\u5b58\u50a8\u5e93\u514b\u9686\u5230\u4f60\u7684\u670d\u52a1\u5668\u3002<\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u6267\u884c\u6b64\u64cd\u4f5c&#xff1a;<\/p>\n<p><span class=\"token function\">git<\/span> clone <span class=\"token operator\">&lt;<\/span>your_app_repository_url<span class=\"token operator\">&gt;<\/span><\/p>\n<p>\u6211\u4f7f\u7528\u7684\u662fXftp7&#xff0c;\u7ed9\u670d\u52a1\u5668\u76f4\u63a5\u4f20\u4e86\u4e2a\u538b\u7f29\u5305&#xff0c;\u6bd5\u7adfnode\u5305\u548c\u539f\u9879\u76ee\u4e0b\u7684\u4e00\u4e9b\u4f9d\u8d56\u9879\u4e0d\u9700\u8981\u62f7\u8d1d\u3002<\/p>\n<p>\u968f\u540e\u5b89\u88c5\u5e94\u7528\u7a0b\u5e8f\u6240\u9700\u7684\u4efb\u4f55\u4f9d\u8d56\u9879\u5e76\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f&#xff0c;\u7136\u540e\u624d\u80fd\u90e8\u7f72\u5b83\u3002<\/p>\n<p>\u4e3a\u6b64&#xff0c;\u8bf7\u5bfc\u822a\u5230\u5e94\u7528\u7a0b\u5e8f\u76ee\u5f55\u5e76\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u5176\u4f9d\u8d56\u9879&#xff1a;<\/p>\n<p><span class=\"token function\">npm<\/span> <span class=\"token function\">install<\/span><\/p>\n<p>\u5b89\u88c5\u4f9d\u8d56\u9879\u540e&#xff0c;\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f&#xff1a;<\/p>\n<p><span class=\"token function\">npm<\/span> run build<\/p>\n<p>\u4e00\u65e6\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\u51c6\u5907\u5c31\u7eea&#xff0c;\u5c06\u9700\u8981\u8bbe\u7f6e PM2\u3002<\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u8fdb\u7a0b\u7ba1\u7406\u5668&#xff0c;\u53ef\u5e2e\u52a9\u4f60\u8ba9\u5e94\u7528\u5728\u540e\u53f0\u8fd0\u884c&#xff0c;\u5e76\u5728\u5e94\u7528\u5d29\u6e83\u65f6\u91cd\u65b0\u542f\u52a8\u3002PM2 \u6613\u4e8e\u5b89\u88c5\u548c\u4f7f\u7528&#xff0c;\u662f\u786e\u4fdd\u4f60\u7684\u5e94\u7528\u59cb\u7ec8\u53ef\u4f9b\u7528\u6237\u4f7f\u7528\u7684\u7edd\u4f73\u65b9\u5f0f\u3002\u8981\u5b89\u88c5 PM2&#xff0c;\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p><span class=\"token function\">npm<\/span> <span class=\"token function\">install<\/span> -g pm2 <\/p>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u7528 PM2 \u542f\u52a8\u5e94\u7528\u7a0b\u5e8f&#xff1a;<\/p>\n<p>pm2 start <span class=\"token function\">npm<\/span> &#8211;name <span class=\"token string\">&#034;your-app-name&#034;<\/span> &#8212; start <\/p>\n<p>\u8fd9\u5c06\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u5e76\u5c06\u5176\u547d\u540d\u4e3a\u201cyour-app-name\u201d\u3002\u5982\u679c\u5e94\u7528\u7a0b\u5e8f\u5d29\u6e83&#xff0c;PM2 \u5c06\u81ea\u52a8\u91cd\u65b0\u542f\u52a8\u5b83\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u901a\u8fc7pm2 list\u67e5\u770b\u5e94\u7528\u7a0b\u5e8f\u7684\u72b6\u6001<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418132718-6802533636b19.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u4fee\u6539\u9879\u76ee<\/p>\n<p>\u66f4\u65b0\u9879\u76ee&#xff0c;\u53ea\u9700\u8981\u4f20\u5165\u6587\u4ef6\u91cd\u65b0npm run build\u540e\u6682\u505cpm2\u8fdb\u7a0b\u5b88\u62a4pm2 stop &lt;name&gt;&#xff0c; \u8fdb\u884cnpm run start\u518d\u91cd\u542fpm2 restart &lt;name&gt;\u5373\u53ef\u5b8c\u6210\u66f4\u65b0\u3002<\/p>\n<p>\u6211\u4e00\u5171\u4e0a\u4f20\u4e86\u4e24\u4e2a\u9879\u76ee&#xff0c;\u7b2c\u4e00\u4e2a\u9879\u76ee\u542f\u52a8\u5728\u9ed8\u8ba4\u7aef\u53e33000\u4e0a&#xff0c; \u7b2c\u4e8c\u4e2a\u9879\u76ee\u5219\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u7aef\u53e3<\/p>\n<p><span class=\"token assign-left variable\">PORT<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">3003<\/span> <span class=\"token function\">npm<\/span> run start<br \/>\n<span class=\"token assign-left variable\">PORT<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">3003<\/span> pm2 start <span class=\"token function\">npm<\/span> &#8211;name <span class=\"token string\">&#034;your-app-name&#034;<\/span> &#8212; start <\/p>\n<hr \/>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u4f60\u9700\u8981\u8bbe\u7f6e Nginx \u6765\u4ee3\u7406\u5bf9\u4f60\u7684\u5e94\u7528\u7684\u8bf7\u6c42\u3002<\/p>\n<p>\u8fd9\u542c\u8d77\u6765\u53ef\u80fd\u5f88\u590d\u6742&#xff0c;\u4f46\u5b9e\u9645\u4e0a\u975e\u5e38\u7b80\u5355\u3002\u4f60\u53ea\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Nginx \u914d\u7f6e\u6587\u4ef6&#xff0c;\u7c98\u8d34\u4e00\u4e9b\u4ee3\u7801&#xff0c;\u7136\u540e\u91cd\u65b0\u542f\u52a8 Nginx\u3002 \u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Nginx \u914d\u7f6e\u6587\u4ef6<\/p>\n<p>server <span class=\"token punctuation\">{<\/span><br \/>\n    listen <span class=\"token number\">80<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    server_name your-domain-name.com www.your-domain-name.com<span class=\"token punctuation\">;<\/span><br \/>\n    location \/ <span class=\"token punctuation\">{<\/span><br \/>\n        proxy_pass http:\/\/localhost:3000<span class=\"token punctuation\">;<\/span><br \/>\n        proxy_set_header Host <span class=\"token variable\">$host<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        proxy_set_header X-Real-IP <span class=\"token variable\">$remote_addr<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5c06\u201cyour-domain-name.com\u201d\u66ff\u6362\u4e3a\u4f60\u7684\u5b9e\u9645\u57df\u540d\u3002\u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\u5e76\u9000\u51fa\u6587\u672c\u7f16\u8f91\u5668\u3002<\/p>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5728 sites-enabled \u76ee\u5f55\u4e2d\u521b\u5efa\u6307\u5411\u914d\u7f6e\u6587\u4ef6\u7684\u7b26\u53f7\u94fe\u63a5&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">ln<\/span> -s \/etc\/nginx\/sites-available\/your-app-name.com \/etc\/nginx\/sites-enabled\/ <\/p>\n<p>\u6700\u540e&#xff0c;\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u91cd\u65b0\u542f\u52a8 Nginx&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> systemctl restart nginx<\/p>\n<p>\u8bbe\u7f6e Nginx \u5e76\u4e14\u7684\u7528\u7a0b\u5e8f\u51c6\u5907\u5c31\u7eea\u540e&#xff0c;\u4f60\u8981\u786e\u4fdd\u60a8\u57df\u540d\u6b63\u786e\u6307\u5411\u60a8\u7684\u670d\u52a1\u5668\u3002<\/p>\n<h3>\u66f4\u65b0 DNS \u8bb0\u5f55\u7684\u65b9\u6cd5\u5982\u4e0b&#xff1a;<\/h3>\n<p>\u767b\u5f55\u60a8\u8d2d\u4e70\u57df\u540d\u7684\u57df\u540d\u6ce8\u518c\u5546\u7f51\u7ad9\u3002 \u67e5\u627e\u60a8\u7684\u57df\u7684 DNS \u7ba1\u7406\u90e8\u5206\u3002 \u6dfb\u52a0\u6307\u5411\u60a8\u670d\u52a1\u5668 IP \u5730\u5740\u7684\u201cA\u201d\u8bb0\u5f55\u3002\u5982\u679c\u60a8\u4e0d\u786e\u5b9a\u5982\u4f55\u67e5\u627e\u60a8\u670d\u52a1\u5668\u7684 IP \u5730\u5740&#xff0c;\u8bf7\u53c2\u9605\u60a8\u7684\u670d\u52a1\u5668\u63d0\u4f9b\u5546\u7684\u6587\u6863\u3002 \u5982\u679c\u60a8\u60f3\u5728\u57df\u540d\u4e2d\u4f7f\u7528\u201cwww\u201d&#xff0c;\u60a8\u4e5f\u53ef\u4ee5\u6dfb\u52a0\u6307\u5411\u57df\u540d\u7684 CNAME \u8bb0\u5f55\u3002 \u4fdd\u5b58\u66f4\u6539\u5e76\u7b49\u5f85\u6700\u591a 24 \u5c0f\u65f6\u4ee5\u4f7f DNS \u66f4\u6539\u5728\u4e92\u8054\u7f51\u4e0a\u4f20\u64ad\u3002 \u4e00\u65e6\u60a8\u7684 DNS \u66f4\u6539\u4f20\u64ad\u51fa\u53bb&#xff0c;\u60a8\u5c31\u9700\u8981\u8bbe\u7f6e Certbot\u3002<\/p>\n<p>\u6b64\u5de5\u5177\u53ef\u5e2e\u52a9\u60a8\u4e3a\u57df\u540d\u8bbe\u7f6e SSL \u52a0\u5bc6\u3002SSL \u52a0\u5bc6\u5f88\u91cd\u8981&#xff0c;\u56e0\u4e3a\u5b83\u6709\u52a9\u4e8e\u4fdd\u62a4\u7528\u6237\u7684\u6570\u636e\u514d\u906d\u7aa5\u63a2\u3002\u8981\u5b89\u88c5 Certbot&#xff0c;\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt-get<\/span> update<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt-get<\/span> <span class=\"token function\">install<\/span> certbot python3-certbot-nginx<\/p>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u751f\u6210 SSL \u8bc1\u4e66&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> certbot &#8211;nginx -d your-domain-name.com -d www.your-domain-name.com<\/p>\n<p>\u5c06\u201cyour-domain-name.com\u201d\u66ff\u6362\u4e3a\u60a8\u7684\u5b9e\u9645\u57df\u540d\u3002\u6309\u7167\u63d0\u793a\u751f\u6210\u60a8\u7684 SSL \u8bc1\u4e66\u3002<\/p>\n<h3>\u66f4\u65b0 Nginx \u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>\u751f\u6210 SSL \u8bc1\u4e66\u540e&#xff0c;\u60a8\u9700\u8981\u66f4\u65b0 Nginx \u914d\u7f6e\u6587\u4ef6\u4ee5\u4f7f\u7528 HTTPS \u800c\u4e0d\u662f HTTP\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6253\u5f00 Nginx \u914d\u7f6e\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">nano<\/span> \/etc\/nginx\/sites-available\/your-app-name.com <\/p>\n<p>\u5c06\u6587\u4ef6\u5185\u5bb9\u66ff\u6362\u4e3a\u4ee5\u4e0b\u4ee3\u7801&#xff1a;<\/p>\n<p>server <span class=\"token punctuation\">{<\/span><br \/>\n    listen <span class=\"token number\">80<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    server_name your-domain-name.com www.your-domain-name.com<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token builtin class-name\">return<\/span> <span class=\"token number\">301<\/span> https:\/\/<span class=\"token variable\">$host<\/span><span class=\"token variable\">$request_uri<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>server <span class=\"token punctuation\">{<\/span><br \/>\n    listen <span class=\"token number\">443<\/span> ssl<span class=\"token punctuation\">;<\/span><br \/>\n    server_name your-domain-name.com www.your-domain-name.com<span class=\"token punctuation\">;<\/span><\/p>\n<p>    ssl_certificate \/etc\/letsencrypt\/live\/your-domain-name.com\/fullchain.pem<span class=\"token punctuation\">;<\/span><br \/>\n    ssl_certificate_key \/etc\/letsencrypt\/live\/your-domain-name.com\/privkey.pem<span class=\"token punctuation\">;<\/span><\/p>\n<p>    location \/ <span class=\"token punctuation\">{<\/span><br \/>\n        proxy_pass http:\/\/localhost:3000<span class=\"token punctuation\">;<\/span><br \/>\n        proxy_set_header Host <span class=\"token variable\">$host<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        proxy_set_header X-Real-IP <span class=\"token variable\">$remote_addr<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5c06\u201cyour-domain-name.com\u201d\u66ff\u6362\u4e3a\u60a8\u7684\u5b9e\u9645\u57df\u540d\u3002\u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\u5e76\u9000\u51fa\u6587\u672c\u7f16\u8f91\u5668\u3002<\/p>\n<p>\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u91cd\u65b0\u542f\u52a8 Nginx&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> systemctl restart nginx <\/p>\n<p>\u6700\u540e&#xff0c;\u4f60\u9700\u8981\u6d4b\u8bd5\u4f60\u7684\u5e94\u7528&#xff0c;\u4ee5\u786e\u4fdd\u4e00\u5207\u6b63\u5e38<\/p>\n<p>\u73b0\u5728&#xff0c;\u4f60\u7684\u5e94\u7528\u5e94\u8be5\u53ef\u4ee5\u901a\u8fc7 HTTPS \u5728\u60a8\u7684\u57df\u540d\u4e0a\u8bbf\u95ee\u3002\u901a\u8fc7\u5728\u7f51\u7edc\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee\u4f60\u7684\u57df\u540d\u6765\u6d4b\u8bd5\u5b83\u3002<\/p>\n<p>\u606d\u559c&#xff01; \u60a8\u521a\u521a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git \u5728 Linux \u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4e86 Next.js \u5e94\u7528\u7a0b\u5e8f\u3002\u4e4d\u4e00\u770b&#xff0c;\u8fd9\u53ef\u80fd\u770b\u8d77\u6765\u5f88\u8270\u5de8&#xff0c;\u4f46\u53ea\u8981\u6709\u4e00\u70b9\u8010\u5fc3\u548c\u6bc5\u529b&#xff0c;\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u505a\u5230\u3002\u795d\u4f60\u597d\u8fd0&#xff01;<\/p>\n<p>\u795d\u4f60\u7f16\u7801\u6109\u5feb&#x1f9d1;&#x1f3fd;\u200d&#x1f4bb;<\/p>\n<hr \/>\n<p>\u6587\u7ae0\u53c2\u8003:https:\/\/dev.to\/j3rry320\/deploy-your-nextjs-app-like-a-pro-a-step-by-step-guide-using-nginx-pm2-certbot-and-git-on-your-linux-server-3286<\/p>\n<p>\u76ee\u524d\u90e8\u7f72Next.js\u9879\u76ee\u7684\u6559\u7a0b\u633a\u591a\u4f46\u662f\u8d28\u91cf\u53c2\u5dee\u4e0d\u9f50&#xff0c;\u8fd9\u662f\u4e00\u7bc7\u975e\u5e38\u6709\u7528\u7684\u6307\u5357&#xff0c;\u89e3\u51b3\u4e86\u6211\u5f88\u591a\u95ee\u9898&#xff0c;\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\u4eec&#xff01;&#x1f604;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.3k\u6b21\uff0c\u70b9\u8d5e42\u6b21\uff0c\u6536\u85cf28\u6b21\u3002\u5047\u8bbe\u4f60\u5df2\u7ecf\u6784\u5efa\u4e86\u4e00\u4e2a Next.js \u5e94\u7528\uff0c\u73b0\u5728\u60f3\u8981\u5c06\u5176\u90e8\u7f72\u5230 Linux \u670d\u52a1\u5668\u4e0a\u3002\u6211\u5c06\u5f15\u5bfc\u4f60\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u3002\u5982\u679c\u6ca1\u6709\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u51e0\u4e2a\u7b80\u5355\u7684\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002\u5b8c\u6210\u540e\uff0c\u4f60\u9700\u8981\u4e3a\u5e94\u7528\u8bbe\u7f6e\u4e00\u4e2a\u57df\u540d\u3002\u4f60\u53ef\u4ee5\u4ece\u57df\u540d\u6ce8\u518c\u5546\u5904\u8d2d\u4e70\u57df\u540d\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u514d\u8d39\u57df\u540d\u63d0\u4f9b\u5546\uff08\u5982 Freenom\uff09\u3002\u6211\u4f7f\u7528\u7684\u662fXftp7\uff0c\u7ed9\u670d\u52a1\u5668\u76f4\u63a5\u4f20\u4e86\u4e2a\u538b\u7f29\u5305\uff0c\u6bd5\u7adfnode\u5305\u548c\u539f\u9879\u76ee\u4e0b\u7684\u4e00\u4e9b\u4f9d\u8d56\u9879\u4e0d\u9700\u8981\u62f7\u8d1d\u3002\u8fd9\u662f\u4e00\u4e2a\u8fdb\u7a0b\u7ba1\u7406\u5668\uff0c\u53ef\u5e2e\u52a9\u4f60\u8ba9\u5e94\u7528\u5728\u540e\u53f0\u8fd0\u884c\uff0c\u5e76\u5728\u3002PM2 \u6613\u4e8e\u5b89\u88c5\u548c\u4f7f\u7528\uff0c\u662f\u786e\u4fdd\u4f60\u7684\u5e94\u7528\u59cb\u7ec8\u53ef\u4f9b\u7528\u6237\u4f7f\u7528\u7684\u7edd\u4f73\u65b9\u5f0f\u3002_next.js nginx<\/p>\n","protected":false},"author":2,"featured_media":14783,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[187,58,943,723,43,502,944,942],"topic":[],"class_list":{"0":"post-14785","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-server","8":"tag-javascript","9":"tag-linux","10":"tag-next-js","11":"tag-react","12":"tag-43","13":"tag-502","15":"tag-942"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u90e8\u7f72Next.js\u5e94\u7528\u8be6\u7ec6\u6307\u5357\uff1a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/14785.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u90e8\u7f72Next.js\u5e94\u7528\u8be6\u7ec6\u6307\u5357\uff1a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.3k\u6b21\uff0c\u70b9\u8d5e42\u6b21\uff0c\u6536\u85cf28\u6b21\u3002\u5047\u8bbe\u4f60\u5df2\u7ecf\u6784\u5efa\u4e86\u4e00\u4e2a Next.js \u5e94\u7528\uff0c\u73b0\u5728\u60f3\u8981\u5c06\u5176\u90e8\u7f72\u5230 Linux \u670d\u52a1\u5668\u4e0a\u3002\u6211\u5c06\u5f15\u5bfc\u4f60\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u3002\u5982\u679c\u6ca1\u6709\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u51e0\u4e2a\u7b80\u5355\u7684\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002\u5b8c\u6210\u540e\uff0c\u4f60\u9700\u8981\u4e3a\u5e94\u7528\u8bbe\u7f6e\u4e00\u4e2a\u57df\u540d\u3002\u4f60\u53ef\u4ee5\u4ece\u57df\u540d\u6ce8\u518c\u5546\u5904\u8d2d\u4e70\u57df\u540d\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u514d\u8d39\u57df\u540d\u63d0\u4f9b\u5546\uff08\u5982 Freenom\uff09\u3002\u6211\u4f7f\u7528\u7684\u662fXftp7\uff0c\u7ed9\u670d\u52a1\u5668\u76f4\u63a5\u4f20\u4e86\u4e2a\u538b\u7f29\u5305\uff0c\u6bd5\u7adfnode\u5305\u548c\u539f\u9879\u76ee\u4e0b\u7684\u4e00\u4e9b\u4f9d\u8d56\u9879\u4e0d\u9700\u8981\u62f7\u8d1d\u3002\u8fd9\u662f\u4e00\u4e2a\u8fdb\u7a0b\u7ba1\u7406\u5668\uff0c\u53ef\u5e2e\u52a9\u4f60\u8ba9\u5e94\u7528\u5728\u540e\u53f0\u8fd0\u884c\uff0c\u5e76\u5728\u3002PM2 \u6613\u4e8e\u5b89\u88c5\u548c\u4f7f\u7528\uff0c\u662f\u786e\u4fdd\u4f60\u7684\u5e94\u7528\u59cb\u7ec8\u53ef\u4f9b\u7528\u6237\u4f7f\u7528\u7684\u7edd\u4f73\u65b9\u5f0f\u3002_next.js nginx\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/14785.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T13:27:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418132718-68025336125b6.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/14785.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/14785.html\",\"name\":\"\u90e8\u7f72Next.js\u5e94\u7528\u8be6\u7ec6\u6307\u5357\uff1a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T13:27:19+00:00\",\"dateModified\":\"2025-04-18T13:27:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/14785.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/14785.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/14785.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u90e8\u7f72Next.js\u5e94\u7528\u8be6\u7ec6\u6307\u5357\uff1a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u90e8\u7f72Next.js\u5e94\u7528\u8be6\u7ec6\u6307\u5357\uff1a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/14785.html","og_locale":"zh_CN","og_type":"article","og_title":"\u90e8\u7f72Next.js\u5e94\u7528\u8be6\u7ec6\u6307\u5357\uff1a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.3k\u6b21\uff0c\u70b9\u8d5e42\u6b21\uff0c\u6536\u85cf28\u6b21\u3002\u5047\u8bbe\u4f60\u5df2\u7ecf\u6784\u5efa\u4e86\u4e00\u4e2a Next.js \u5e94\u7528\uff0c\u73b0\u5728\u60f3\u8981\u5c06\u5176\u90e8\u7f72\u5230 Linux \u670d\u52a1\u5668\u4e0a\u3002\u6211\u5c06\u5f15\u5bfc\u4f60\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u3002\u5982\u679c\u6ca1\u6709\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u51e0\u4e2a\u7b80\u5355\u7684\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002\u5b8c\u6210\u540e\uff0c\u4f60\u9700\u8981\u4e3a\u5e94\u7528\u8bbe\u7f6e\u4e00\u4e2a\u57df\u540d\u3002\u4f60\u53ef\u4ee5\u4ece\u57df\u540d\u6ce8\u518c\u5546\u5904\u8d2d\u4e70\u57df\u540d\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u514d\u8d39\u57df\u540d\u63d0\u4f9b\u5546\uff08\u5982 Freenom\uff09\u3002\u6211\u4f7f\u7528\u7684\u662fXftp7\uff0c\u7ed9\u670d\u52a1\u5668\u76f4\u63a5\u4f20\u4e86\u4e2a\u538b\u7f29\u5305\uff0c\u6bd5\u7adfnode\u5305\u548c\u539f\u9879\u76ee\u4e0b\u7684\u4e00\u4e9b\u4f9d\u8d56\u9879\u4e0d\u9700\u8981\u62f7\u8d1d\u3002\u8fd9\u662f\u4e00\u4e2a\u8fdb\u7a0b\u7ba1\u7406\u5668\uff0c\u53ef\u5e2e\u52a9\u4f60\u8ba9\u5e94\u7528\u5728\u540e\u53f0\u8fd0\u884c\uff0c\u5e76\u5728\u3002PM2 \u6613\u4e8e\u5b89\u88c5\u548c\u4f7f\u7528\uff0c\u662f\u786e\u4fdd\u4f60\u7684\u5e94\u7528\u59cb\u7ec8\u53ef\u4f9b\u7528\u6237\u4f7f\u7528\u7684\u7edd\u4f73\u65b9\u5f0f\u3002_next.js nginx","og_url":"https:\/\/www.wsisp.com\/helps\/14785.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T13:27:19+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418132718-68025336125b6.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/14785.html","url":"https:\/\/www.wsisp.com\/helps\/14785.html","name":"\u90e8\u7f72Next.js\u5e94\u7528\u8be6\u7ec6\u6307\u5357\uff1a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T13:27:19+00:00","dateModified":"2025-04-18T13:27:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/14785.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/14785.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/14785.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u90e8\u7f72Next.js\u5e94\u7528\u8be6\u7ec6\u6307\u5357\uff1a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 Nginx\u3001PM2\u3001Certbot \u548c Git"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/14785","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=14785"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/14785\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/14783"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=14785"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=14785"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=14785"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=14785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}