{"id":86,"date":"2026-03-16T12:19:08","date_gmt":"2026-03-16T04:19:08","guid":{"rendered":"https:\/\/www.loongdi.net\/blog\/?p=86"},"modified":"2026-03-16T12:19:08","modified_gmt":"2026-03-16T04:19:08","slug":"%e7%be%8e%e5%9b%bdvps%e4%b8%bb%e6%9c%ba%e6%80%8e%e4%b9%88%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae%e4%b8%80%e4%b8%aa%e5%9f%ba%e6%9c%ac%e7%9a%84lamp%e7%8e%af%e5%a2%83%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.loongdi.net\/blog\/86.html","title":{"rendered":"\u7f8e\u56fdVPS\u4e3b\u673a\u600e\u4e48\u5b89\u88c5\u548c\u914d\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684LAMP\u73af\u5883\uff1f"},"content":{"rendered":"<p><p>\u672c\u6587\u5c06\u6307\u5bfc\u60a8\u5982\u4f55\u5728\u7f8e\u56fdVPS\u4e3b\u673a\u4e0a\u5b89\u88c5\u548c\u914d\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684LAMP\uff08Linux, Apache, MySQL, PHP\uff09\u73af\u5883\u3002\u8fd9\u5c06\u4f7f\u60a8\u80fd\u591f\u8fd0\u884cPHP\u5e94\u7528\u7a0b\u5e8f\u548c\u7f51\u7ad9\u3002\u6211\u4eec\u5c06\u4f7f\u7528CentOS 7\u4f5c\u4e3a\u64cd\u4f5c\u7cfb\u7edf\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\u5df2\u7ecf\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u62e5\u6709\u4e00\u4e2a\u7f8e\u56fdVPS\u4e3b\u673a\u8d26\u53f7\u3002<\/li>\n<li>\u80fd\u591f\u901a\u8fc7SSH\u8fde\u63a5\u5230\u60a8\u7684VPS\u3002<\/li>\n<li>\u4e86\u89e3\u57fa\u672c\u7684Linux\u547d\u4ee4\u884c\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<p><h2>\u5b89\u88c5Apache<\/h2>\n<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.loongdi.net\/blog\/wp-content\/uploads\/2026\/03\/FTTz2DLK1.jpg\" alt=\"\u7f8e\u56fdVPS\u4e3b\u673a\u600e\u4e48\u5b89\u88c5\u548c\u914d\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684LAMP\u73af\u5883\uff1f\" title=\"\u7f8e\u56fdVPS\u4e3b\u673a\u600e\u4e48\u5b89\u88c5\u548c\u914d\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684LAMP\u73af\u5883\uff1f\"><\/p>\n<p><h3>1. \u66f4\u65b0\u7cfb\u7edf\u5305\u5217\u8868<\/h3>\n<\/p>\n<p><pre><code>yum update<\/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\u3002<\/p>\n<\/p>\n<p><h3>2. \u5b89\u88c5Apache<\/h3>\n<\/p>\n<p><pre><code>yum install httpd<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5b89\u88c5Apache\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><h3>3. \u542f\u52a8Apache\u670d\u52a1<\/h3>\n<\/p>\n<p><pre><code>systemctl start httpd<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u542f\u52a8Apache\u670d\u52a1\u3002<\/p>\n<\/p>\n<p><h3>4. \u8bbe\u7f6eApache\u670d\u52a1\u5f00\u673a\u81ea\u542f<\/h3>\n<\/p>\n<p><pre><code>systemctl enable httpd<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u4f7fApache\u5728\u7cfb\u7edf\u542f\u52a8\u65f6\u81ea\u52a8\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h2>\u5b89\u88c5MySQL<\/h2>\n<\/p>\n<p><h3>1. \u5b89\u88c5MySQL<\/h3>\n<\/p>\n<p><pre><code>yum install mariadb-server<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5b89\u88c5MySQL\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><h3>2. \u542f\u52a8MySQL\u670d\u52a1<\/h3>\n<\/p>\n<p><pre><code>systemctl start mysqld<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u542f\u52a8MySQL\u670d\u52a1\u3002<\/p>\n<\/p>\n<p><h3>3. \u8bbe\u7f6eMySQL\u670d\u52a1\u5f00\u673a\u81ea\u542f<\/h3>\n<\/p>\n<p><pre><code>systemctl enable mysqld<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u4f7fMySQL\u5728\u7cfb\u7edf\u542f\u52a8\u65f6\u81ea\u52a8\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h2>\u5b89\u88c5PHP<\/h2>\n<\/p>\n<p><h3>1. \u5b89\u88c5PHP<\/h3>\n<\/p>\n<p><pre><code>yum install php php-mysql<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5b89\u88c5PHP\u548cPHP\u7684MySQL\u6269\u5c55\u3002<\/p>\n<\/p>\n<p><h3>2. \u914d\u7f6eApache\u4ee5\u652f\u6301PHP<\/h3>\n<\/p>\n<p><p>\u7f16\u8f91Apache\u914d\u7f6e\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u4e8e\uff1a<\/p>\n<\/p>\n<p><pre><code>vi \/etc\/httpd\/conf\/httpd.conf<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u627e\u5230\u4ee5\u4e0b\u884c\u5e76\u53d6\u6d88\u6ce8\u91ca\uff1a<\/p>\n<\/p>\n<p><pre><code>LoadModule php7_module modules\/libphp7.so<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u884c\u4ee5\u542f\u7528PHP\u5904\u7406\uff1a<\/p>\n<\/p>\n<p><pre><code>AddType application\/x-httpd-php .php<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>3. \u91cd\u542fApache\u670d\u52a1<\/h3>\n<\/p>\n<p><pre><code>systemctl restart httpd<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u4f7fApache\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u5e76\u5f00\u59cb\u5904\u7406PHP\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h2>\u6d4b\u8bd5LAMP\u73af\u5883<\/h2>\n<\/p>\n<p><h3>1. \u521b\u5efa\u4e00\u4e2aPHP\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u5728\u60a8\u7684Web\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>?&gt;<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u8bbf\u95ee\u60a8\u7684\u7f51\u7ad9<\/h3>\n<\/p>\n<p><p>\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee <a rel=\"nofollow\" href=\"http:\/\/your_vps_ip\/info.php\">http:\/\/your_vps_ip\/info.php<\/a>\uff0c\u60a8\u5e94\u8be5\u770b\u5230PHP\u7684\u4fe1\u606f\u9875\u9762\u3002<\/p>\n<\/p>\n<p><h2>\u6ce8\u610f\u4e8b\u9879<\/h2>\n<\/p>\n<ul>\n<li>\u786e\u4fdd\u60a8\u7684VPS\u9632\u706b\u5899\u5141\u8bb8HTTP\u548cMySQL\u7aef\u53e3\uff08\u9ed8\u8ba4\u4e3a80\u548c3306\uff09\u3002<\/li>\n<li>\u5982\u679c\u60a8\u9047\u5230\u6743\u9650\u95ee\u9898\uff0c\u53ef\u80fd\u9700\u8981\u66f4\u6539\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u6743\u9650\u3002<\/li>\n<li>\u786e\u4fdd\u60a8\u7684PHP\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4f4d\u4e8e <code>\/etc\/php.ini<\/code>\uff09\u6b63\u786e\u8bbe\u7f6e\u4e86\u5185\u5b58\u9650\u5236\u548c\u5176\u4ed6\u53c2\u6570\u3002<\/li>\n<\/ul>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5df2\u6210\u529f\u5728\u7f8e\u56fdVPS\u4e3b\u673a\u4e0a\u5b89\u88c5\u548c\u914d\u7f6e\u4e86\u4e00\u4e2a\u57fa\u672c\u7684LAMP\u73af\u5883\u3002<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5c06\u6307\u5bfc\u60a8\u5982\u4f55\u5728\u7f8e\u56fdVPS\u4e3b\u673a\u4e0a\u5b89\u88c5\u548c\u914d\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684LAMP\uff08Linux, Apache, MySQL, PHP\uff09\u73af\u5883\u3002\u8fd9\u5c06\u4f7f\u60a8\u80fd\u591f\u8fd0\u884cPHP\u5e94\u7528\u7a0b\u5e8f\u548c\u7f51\u7ad9\u3002\u6211\u4eec\u5c06\u4f7f\u7528CentOS 7\u4f5c\u4e3a\u64cd\u4f5c\u7cfb\u7edf\u3002 \u64cd\u4f5c\u524d\u7684\u51c6\u5907\u6216\u80cc\u666f\u4ecb\u7ecd \u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7&#8230;<\/p>\n","protected":false},"author":1,"featured_media":13,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"topic":[],"class_list":["post-86","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\/86","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=86"}],"version-history":[{"count":1,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":87,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions\/87"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media\/13"}],"wp:attachment":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/tags?post=86"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/topic?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}