{"id":721,"date":"2026-03-08T16:48:52","date_gmt":"2026-03-08T08:48:52","guid":{"rendered":"https:\/\/www.loongdi.net\/blog\/?p=721"},"modified":"2026-03-08T16:48:52","modified_gmt":"2026-03-08T08:48:52","slug":"%e5%93%aa%e4%b8%aa%ef%bc%82%e9%a6%99%e6%b8%afvps%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e7%9a%84lamp%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/www.loongdi.net\/blog\/721.html","title":{"rendered":"\u54ea\u4e2a\uff02\u9999\u6e2fVPS\u670d\u52a1\u5668\u4e0a\u7684LAMP\u73af\u5883\u914d\u7f6e\u6307\u5357"},"content":{"rendered":"<p><p>\u672c\u6587\u65e8\u5728\u4e3a\u6280\u672f\u7528\u6237\u63d0\u4f9b\u4e00\u4e2a\u5b9e\u64cd\u5bfc\u5411\u7684\u6307\u5357\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u638c\u63e1\u5982\u4f55\u5728\u9999\u6e2fVPS\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eLAMP\u73af\u5883\uff08Linux, Apache, MySQL, PHP\uff09\u3002\u901a\u8fc7\u672c\u6587\uff0c\u60a8\u5c06\u80fd\u591f\u4ece\u96f6\u5f00\u59cb\uff0c\u9010\u6b65\u5b8c\u6210\u4ee5\u4e0b\u4efb\u52a1\uff1a<\/p>\n<\/p>\n<p><h2>\u4efb\u52a1\u76ee\u6807<\/h2>\n<\/p>\n<p><p>\u5728\u60a8\u7684\u9999\u6e2fVPS\u670d\u52a1\u5668\u4e0a\u6210\u529f\u5b89\u88c5\u5e76\u914d\u7f6eLAMP\u73af\u5883\uff0c\u4ee5\u4fbf\u8fd0\u884cPHP\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u524d\u7684\u51c6\u5907<\/h2>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u5df2\u7ecf\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u62e5\u6709\u4e00\u4e2a\u9999\u6e2fVPS\u670d\u52a1\u5668\u3002<\/li>\n<li>\u8fdc\u7a0b\u767b\u5f55\u5230\u60a8\u7684\u670d\u52a1\u5668\u3002<\/li>\n<li>\u62e5\u6709root\u6743\u9650\u6216\u5177\u6709\u76f8\u5e94\u6743\u9650\u7684\u7528\u6237\u3002<\/li>\n<\/ul>\n<p><h2>\u5b89\u88c5Apache<\/h2>\n<\/p>\n<p><h3>\u6b65\u9aa41\uff1a\u66f4\u65b0\u7cfb\u7edf\u5305\u5217\u8868<\/h3>\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><p>\u8fd9\u5c06\u786e\u4fdd\u60a8\u7684\u7cfb\u7edf\u5305\u5217\u8868\u662f\u6700\u65b0\u7684\uff0c\u4ee5\u4fbf\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u627e\u5230\u6700\u65b0\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa42\uff1a\u5b89\u88c5Apache<\/h3>\n<\/p>\n<p><pre><code>sudo apt install apache2<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8be5\u547d\u4ee4\u4f1a\u81ea\u52a8\u5b89\u88c5Apache\u670d\u52a1\u5668\u53ca\u5176\u76f8\u5173\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa43\uff1a\u542f\u52a8Apache\u670d\u52a1<\/h3>\n<\/p>\n<p><pre><code>sudo systemctl start apache2<\/p>\r\n<p>sudo systemctl enable apache2<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u542f\u52a8Apache\u670d\u52a1\u5e76\u8bbe\u7f6e\u5176\u5728\u542f\u52a8\u65f6\u81ea\u52a8\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h2>\u5b89\u88c5MySQL<\/h2>\n<\/p>\n<p><h3>\u6b65\u9aa41\uff1a\u5b89\u88c5MySQL<\/h3>\n<\/p>\n<p><pre><code>sudo apt install mysql-server<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8be5\u547d\u4ee4\u4f1a\u5b89\u88c5MySQL\u670d\u52a1\u5668\u53ca\u5176\u76f8\u5173\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa42\uff1a\u914d\u7f6eMySQL<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u9700\u8981\u8bbe\u7f6eMySQL\u7684root\u5bc6\u7801\u3002<\/p>\n<\/p>\n<p><pre><code>sudo mysql_secure_installation<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6309\u7167\u63d0\u793a\u5b8c\u6210\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u8bbe\u7f6eroot\u5bc6\u7801<\/li>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.loongdi.net\/blog\/wp-content\/uploads\/2026\/03\/62LS5.jpg\" alt=\"\u54ea\u4e2a\uff02\u9999\u6e2fVPS\u670d\u52a1\u5668\u4e0a\u7684LAMP\u73af\u5883\u914d\u7f6e\u6307\u5357\" title=\"\u54ea\u4e2a\uff02\u9999\u6e2fVPS\u670d\u52a1\u5668\u4e0a\u7684LAMP\u73af\u5883\u914d\u7f6e\u6307\u5357\"><\/p>\n<li>\u79fb\u9664\u533f\u540d\u7528\u6237<\/li>\n<li>\u7981\u6b62root\u7528\u6237\u8fdc\u7a0b\u767b\u5f55<\/li>\n<li>\u5220\u9664test\u6570\u636e\u5e93<\/li>\n<li>\u9000\u51famysql_secure_installation<\/p>\n<p><\/code><\/p>\n<\/ul>\n<p><h2>\u5b89\u88c5PHP<\/h2>\n<\/p>\n<p><h3>\u6b65\u9aa41\uff1a\u5b89\u88c5PHP<\/h3>\n<\/p>\n<p><pre><code>sudo apt install php<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5PHP\u65f6\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u5b89\u88c5PHP\u7684\u6269\u5c55\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code>sudo apt install php-mysql php-gd php-xml php-zip php-curl<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5b89\u88c5PHP\u53ca\u5176\u5e38\u7528\u6269\u5c55\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa42\uff1a\u914d\u7f6eApache\u4ee5\u652f\u6301PHP<\/h3>\n<\/p>\n<p><p>\u7f16\u8f91Apache\u914d\u7f6e\u6587\u4ef6\u4ee5\u542f\u7528PHP\u6a21\u5757\u3002<\/p>\n<\/p>\n<p><pre><code>sudo a2enmod php7.x<\/p>\r\n<p>sudo systemctl restart apache2<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c06`7.x`\u66ff\u6362\u4e3a\u60a8\u7684PHP\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h2>\u6d4b\u8bd5LAMP\u73af\u5883<\/h2>\n<\/p>\n<p><h3>\u6b65\u9aa41\uff1a\u521b\u5efa\u4e00\u4e2aPHP\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u5728\u60a8\u7684Apache\u7f51\u7ad9\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a`info.php`\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>?&gt;<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u6b65\u9aa42\uff1a\u8bbf\u95ee\u6d4b\u8bd5\u9875\u9762<\/h3>\n<\/p>\n<p><p>\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee`http:\/\/yourdomain.com\/info.php`\uff0c\u60a8\u5e94\u8be5\u770b\u5230PHP\u7684\u4fe1\u606f\u9875\u9762\u3002<\/p>\n<\/p>\n<p><h2>\u5e38\u89c1\u95ee\u9898\u53ca\u6ce8\u610f\u4e8b\u9879<\/h2>\n<\/p>\n<ul>\n<li>\u786e\u4fdd\u60a8\u7684VPS\u670d\u52a1\u5668\u9632\u706b\u5899\u5141\u8bb8HTTP\uff0880\uff09\u548cMySQL\uff083306\uff09\u7aef\u53e3\u3002<\/li>\n<li>\u5982\u679c\u60a8\u9047\u5230\u6743\u9650\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u60a8\u6709\u6b63\u786e\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u6743\u9650\u3002<\/li>\n<li>\u5728\u5b89\u88c5\u548c\u914d\u7f6e\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u60a8\u9075\u5faa\u4e86\u6240\u6709\u5b89\u5168\u6700\u4f73\u5b9e\u8df5\u3002<\/li>\n<\/ul>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5df2\u7ecf\u6210\u529f\u5728\u9999\u6e2fVPS\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u5e76\u914d\u7f6e\u4e86LAMP\u73af\u5883\u3002\u73b0\u5728\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u8fd0\u884cPHP\u5e94\u7528\u7a0b\u5e8f\u4e86\u3002<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u65e8\u5728\u4e3a\u6280\u672f\u7528\u6237\u63d0\u4f9b\u4e00\u4e2a\u5b9e\u64cd\u5bfc\u5411\u7684\u6307\u5357\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u638c\u63e1\u5982\u4f55\u5728\u9999\u6e2fVPS\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eLAMP\u73af\u5883\uff08Linux, Apache, MySQL, PHP\uff09\u3002\u901a\u8fc7\u672c\u6587\uff0c\u60a8\u5c06\u80fd\u591f\u4ece\u96f6\u5f00\u59cb\uff0c\u9010\u6b65\u5b8c\u6210\u4ee5\u4e0b\u4efb\u52a1\uff1a \u4efb\u52a1\u76ee\u6807 \u5728\u60a8\u7684\u9999\u6e2fVPS\u670d\u52a1\u5668\u4e0a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":84,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"topic":[],"class_list":["post-721","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\/721","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=721"}],"version-history":[{"count":1,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/721\/revisions"}],"predecessor-version":[{"id":722,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/721\/revisions\/722"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media\/84"}],"wp:attachment":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media?parent=721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/categories?post=721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/tags?post=721"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/topic?post=721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}