{"id":301,"date":"2026-04-03T15:15:26","date_gmt":"2026-04-03T07:15:26","guid":{"rendered":"https:\/\/www.loongdi.net\/blog\/?p=301"},"modified":"2026-04-03T15:15:26","modified_gmt":"2026-04-03T07:15:26","slug":"%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e5%9f%ba%e6%9c%ac%e7%9a%84lamp%e7%8e%af%e5%a2%83%e5%9c%a8vps%e4%b8%bb%e6%9c%ba%e4%b8%8a%e7%9a%84%e6%ad%a5%e9%aa%a4","status":"publish","type":"post","link":"https:\/\/www.loongdi.net\/blog\/301.html","title":{"rendered":"\u5feb\u901f\u642d\u5efa\u57fa\u672c\u7684LAMP\u73af\u5883\u5728VPS\u4e3b\u673a\u4e0a\u7684\u6b65\u9aa4"},"content":{"rendered":"<p><p>\u672c\u6587\u5c06\u4e3a\u60a8\u8be6\u7ec6\u8bb2\u89e3\u5982\u4f55\u5728VPS\u4e3b\u673a\u4e0a\u5b89\u88c5\u548c\u914d\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684LAMP\uff08Linux, Apache, MySQL, PHP\uff09\u73af\u5883\u3002\u8fd9\u5c06\u5e2e\u52a9\u60a8\u5feb\u901f\u642d\u5efa\u4e00\u4e2a\u53ef\u4ee5\u8fd0\u884cPHP\u5e94\u7528\u7a0b\u5e8f\u7684\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u524d\u7684\u51c6\u5907\u6216\u80cc\u666f\u4ecb\u7ecd<\/h2>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u7684VPS\u4e3b\u673a\u5df2\u7ecf\u5b89\u88c5\u4e86Linux\u64cd\u4f5c\u7cfb\u7edf\u3002\u4ee5\u4e0b\u6b65\u9aa4\u5c06\u4ee5Ubuntu 20.04\u4e3a\u4f8b\u8fdb\u884c\u8bf4\u660e\u3002<\/p>\n<\/p>\n<p><h2>\u5b8c\u6210\u4efb\u52a1\u6240\u9700\u7684\u8be6\u7ec6\u3001\u5206\u6b65\u64cd\u4f5c\u6307\u5357<\/h2>\n<\/p>\n<p><h3>\u6b65\u9aa41\uff1a\u66f4\u65b0\u7cfb\u7edf\u8f6f\u4ef6\u5305<\/h3>\n<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.loongdi.net\/blog\/wp-content\/uploads\/2026\/03\/4zSko4zX.jpg\" alt=\"\u5feb\u901f\u642d\u5efa\u57fa\u672c\u7684LAMP\u73af\u5883\u5728VPS\u4e3b\u673a\u4e0a\u7684\u6b65\u9aa4\" title=\"\u5feb\u901f\u642d\u5efa\u57fa\u672c\u7684LAMP\u73af\u5883\u5728VPS\u4e3b\u673a\u4e0a\u7684\u6b65\u9aa4\"><\/p>\n<p><p>\u9996\u5148\uff0c\u66f4\u65b0\u60a8\u7684\u7cfb\u7edf\u8f6f\u4ef6\u5305\u4ee5\u786e\u4fdd\u6240\u6709\u8f6f\u4ef6\u90fd\u662f\u6700\u65b0\u7684\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt update<\/p>\r\n<p>sudo apt upgrade<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u6b65\u9aa42\uff1a\u5b89\u88c5Apache\u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5Apache\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt install apache2<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee <strong>http:\/\/your_vps_ip_address\/<\/strong> \u6765\u786e\u8ba4Apache\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\u5e76\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa43\uff1a\u5b89\u88c5MySQL\u6570\u636e\u5e93\u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5MySQL\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt install mysql-server<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u60a8\u5c06\u9700\u8981\u8bbe\u7f6eMySQL\u7684root\u7528\u6237\u5bc6\u7801\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa44\uff1a\u5b89\u88c5PHP\u548c\u6240\u9700\u7684PHP\u6a21\u5757<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5PHP\u4ee5\u53ca\u4e00\u4e9b\u5e38\u7528\u7684PHP\u6269\u5c55\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt install php php-mysql php-zip php-gd php-xml php-mbstring<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u6b65\u9aa45\uff1a\u914d\u7f6eApache\u4ee5\u652f\u6301PHP<\/h3>\n<\/p>\n<p><p>\u7f16\u8f91Apache\u7684\u914d\u7f6e\u6587\u4ef6\u4ee5\u542f\u7528PHP\u6a21\u5757\u3002<\/p>\n<\/p>\n<p><pre><code>sudo a2enmod php7.4<\/p>\r\n<p>sudo systemctl restart apache2<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8bf7\u6839\u636e\u60a8\u7684PHP\u7248\u672c\u66ff\u6362 <strong>php7.4<\/strong> \u4e3a\u60a8\u5b89\u88c5\u7684PHP\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa46\uff1a\u6d4b\u8bd5PHP\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u5728Apache\u7684\u7f51\u7ad9\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a <strong>info.php<\/strong> \u7684\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code>&lt;?php<\/p>\r\n<p>phpinfo();<\/p>\r\n<p>?><\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u6587\u4ef6\u540e\uff0c\u901a\u8fc7\u8bbf\u95ee <strong>http:\/\/your_vps_ip_address\/info.php<\/strong> \u6765\u67e5\u770bPHP\u914d\u7f6e\u4fe1\u606f\uff0c\u786e\u8ba4PHP\u5df2\u6b63\u786e\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h2>\u6d89\u53ca\u7684\u5173\u952e\u547d\u4ee4\u3001\u4ee3\u7801\u6216\u914d\u7f6e\u793a\u4f8b<\/h2>\n<\/p>\n<ul>\n<li><strong>sudo apt update<\/strong> \u548c <strong>sudo apt upgrade<\/strong>\uff1a\u66f4\u65b0\u7cfb\u7edf\u8f6f\u4ef6\u5305\u3002<\/li>\n<li><strong>sudo apt install apache2<\/strong>\uff1a\u5b89\u88c5Apache\u670d\u52a1\u5668\u3002<\/li>\n<li><strong>sudo apt install mysql-server<\/strong>\uff1a\u5b89\u88c5MySQL\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002<\/li>\n<li><strong>sudo apt install php php-mysql php-zip php-gd php-xml php-mbstring<\/strong>\uff1a\u5b89\u88c5PHP\u548cPHP\u6269\u5c55\u3002<\/li>\n<li><strong>sudo a2enmod php7.4<\/strong> \u548c <strong>sudo systemctl restart apache2<\/strong>\uff1a\u542f\u7528PHP\u6a21\u5757\u5e76\u91cd\u542fApache\u670d\u52a1\u3002<\/li>\n<li><strong>phpinfo();<\/strong>\uff1aPHP\u5185\u7f6e\u51fd\u6570\uff0c\u7528\u4e8e\u663e\u793aPHP\u914d\u7f6e\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<p><h2>\u5bf9\u547d\u4ee4\u3001\u4ee3\u7801\u6216\u91cd\u8981\u6982\u5ff5\u7684\u6e05\u6670\u89e3\u91ca<\/h2>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u6b65\u9aa4\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86 <strong>apt<\/strong> \u547d\u4ee4\u6765\u5b89\u88c5\u8f6f\u4ef6\u5305\uff0c\u8fd9\u662fUbuntu\u7cfb\u7edf\u4e2d\u7528\u4e8e\u8f6f\u4ef6\u5305\u7ba1\u7406\u7684\u5de5\u5177\u3002\u901a\u8fc7\u7f16\u8f91Apache\u7684\u914d\u7f6e\u6587\u4ef6\u5e76\u542f\u7528PHP\u6a21\u5757\uff0c\u6211\u4eec\u8ba9Apache\u670d\u52a1\u5668\u80fd\u591f\u6b63\u786e\u5730\u5904\u7406PHP\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\u3001\u6ce8\u610f\u4e8b\u9879\u6216\u76f8\u5173\u7684\u5b9e\u7528\u6280\u5de7<\/h2>\n<\/p>\n<ul>\n<li><strong>\u95ee\u9898\uff1a<\/strong>Apache\u65e0\u6cd5\u542f\u52a8\u3002<\/li>\n<li><strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong>\u68c0\u67e5Apache\u7684\u9519\u8bef\u65e5\u5fd7\uff0c\u901a\u5e38\u4f4d\u4e8e <strong>\/var\/log\/apache2\/error.log<\/strong>\uff0c\u4ee5\u67e5\u627e\u542f\u52a8\u5931\u8d25\u7684\u539f\u56e0\u3002<\/li>\n<li><strong>\u95ee\u9898\uff1a<\/strong>MySQL\u670d\u52a1\u65e0\u6cd5\u542f\u52a8\u3002<\/li>\n<li><strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong>\u68c0\u67e5MySQL\u7684\u9519\u8bef\u65e5\u5fd7\uff0c\u901a\u5e38\u4f4d\u4e8e <strong>\/var\/log\/mysql\/error.log<\/strong>\uff0c\u4ee5\u67e5\u627e\u542f\u52a8\u5931\u8d25\u7684\u539f\u56e0\u3002<\/li>\n<li><strong>\u6ce8\u610f\u4e8b\u9879\uff1a<\/strong>\u786e\u4fdd\u60a8\u5728\u5b89\u88c5\u8f6f\u4ef6\u5305\u65f6\u5177\u6709\u8db3\u591f\u7684\u6743\u9650\uff0c\u901a\u5e38\u9700\u8981\u4f7f\u7528 <strong>sudo<\/strong> \u524d\u7f00\u3002<\/li>\n<li><strong>\u5b9e\u7528\u6280\u5de7\uff1a<\/strong>\u5b9a\u671f\u5907\u4efd\u60a8\u7684\u7f51\u7ad9\u6570\u636e\u548c\u6570\u636e\u5e93\uff0c\u4ee5\u9632\u6570\u636e\u4e22\u5931\u6216\u635f\u574f\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5c06\u4e3a\u60a8\u8be6\u7ec6\u8bb2\u89e3\u5982\u4f55\u5728VPS\u4e3b\u673a\u4e0a\u5b89\u88c5\u548c\u914d\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684LAMP\uff08Linux, Apache, MySQL, PHP\uff09\u73af\u5883\u3002\u8fd9\u5c06\u5e2e\u52a9\u60a8\u5feb\u901f\u642d\u5efa\u4e00\u4e2a\u53ef\u4ee5\u8fd0\u884cPHP\u5e94\u7528\u7a0b\u5e8f\u7684\u670d\u52a1\u5668\u3002 \u64cd\u4f5c\u524d\u7684\u51c6\u5907\u6216\u80cc\u666f\u4ecb\u7ecd \u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u7684VPS\u4e3b\u673a\u5df2\u7ecf&#8230;<\/p>\n","protected":false},"author":1,"featured_media":31,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"topic":[],"class_list":["post-301","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hw"],"_links":{"self":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/comments?post=301"}],"version-history":[{"count":1,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/301\/revisions"}],"predecessor-version":[{"id":302,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/301\/revisions\/302"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media\/31"}],"wp:attachment":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media?parent=301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/categories?post=301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/tags?post=301"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/topic?post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}