{"id":1127,"date":"2025-10-11T17:16:48","date_gmt":"2025-10-11T09:16:48","guid":{"rendered":"https:\/\/www.chinaenow.com\/blog\/?p=1127"},"modified":"2025-10-11T17:16:48","modified_gmt":"2025-10-11T09:16:48","slug":"%e4%bd%bf%e7%94%a8%e5%be%b7%e8%bf%85%e7%bd%91%e7%bb%9c%e5%bf%ab%e9%80%9f%e9%83%a8%e7%bd%b2lamp%e7%8e%af%e5%a2%83%ef%bc%9a%e5%ae%9e%e6%93%8d%e6%8c%87%e5%8d%97%e5%92%8c%e6%95%85%e9%9a%9c%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.chinaenow.com\/blog\/1127.html","title":{"rendered":"\u4f7f\u7528\u5fb7\u8fc5\u7f51\u7edc\u5feb\u901f\u90e8\u7f72LAMP\u73af\u5883\uff1a\u5b9e\u64cd\u6307\u5357\u548c\u6545\u969c\u89e3\u51b3\u30102022\u6392\u540d\u6700\u65b0\u3011"},"content":{"rendered":"<p><p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4ee5\u5b9e\u64cd\u4e3a\u5bfc\u5411\uff0c\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u5fb7\u8fc5\u7f51\u7edc\u63d0\u4f9b\u7684\u670d\u52a1\u8fdb\u884c\u7f51\u7ad9\u90e8\u7f72\u3002\u6211\u4eec\u5c06\u89e3\u51b3\u7684\u5173\u952e\u95ee\u9898\u662f\uff1a\u5982\u4f55\u5728\u5fb7\u8fc5\u7f51\u7edc\u7684\u670d\u52a1\u5668\u4e0a\u5feb\u901f\u90e8\u7f72\u4e00\u4e2a\u57fa\u4e8eNginx\u548cMySQL\u7684LAMP\u73af\u5883\u3002<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.chinaenow.com\/blog\/wp-content\/uploads\/2025\/10\/2UYIukbFP3.jpg\" alt=\"\u4f7f\u7528\u5fb7\u8fc5\u7f51\u7edc\u5feb\u901f\u90e8\u7f72LAMP\u73af\u5883\uff1a\u5b9e\u64cd\u6307\u5357\u548c\u6545\u969c\u89e3\u51b3\u30102022\u6392\u540d\u6700\u65b0\u3011\" title=\"\u4f7f\u7528\u5fb7\u8fc5\u7f51\u7edc\u5feb\u901f\u90e8\u7f72LAMP\u73af\u5883\uff1a\u5b9e\u64cd\u6307\u5357\u548c\u6545\u969c\u89e3\u51b3\u30102022\u6392\u540d\u6700\u65b0\u3011\"><\/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\u62e5\u6709\u4ee5\u4e0b\u51c6\u5907\u5de5\u4f5c\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4e00\u4e2a\u5fb7\u8fc5\u7f51\u7edc\u7684\u4e91\u670d\u52a1\u5668\u6216VPS\u3002<\/li>\n<li>\u8fdc\u7a0b\u767b\u5f55\u670d\u52a1\u5668\u7684\u6743\u9650\u3002<\/li>\n<li>\u57fa\u672c\u7684Linux\u547d\u4ee4\u884c\u64cd\u4f5c\u7ecf\u9a8c\u3002<\/li>\n<\/ul>\n<p><h2>\u4efb\u52a1\uff1a\u90e8\u7f72LAMP\u73af\u5883<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u7684\u76ee\u6807\u662f\u4f7f\u7528Nginx\u4f5c\u4e3aWeb\u670d\u52a1\u5668\uff0cApache\u4f5c\u4e3a\u5907\u7528\u670d\u52a1\u5668\uff0cMySQL\u4f5c\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u5e76\u914d\u7f6ePHP\u73af\u5883\u3002<\/p>\n<\/p>\n<p><h3>1. \u5b89\u88c5Nginx<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5Nginx\u3002\u4ee5\u4e0b\u662f\u5b89\u88c5\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><pre><code>sudo apt update<\/p>\r\n<p>sudo apt install nginx<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u89e3\u91ca\uff1a<\/strong>\u4f7f\u7528<code>apt update<\/code>\u66f4\u65b0\u672c\u5730\u5305\u7d22\u5f15\uff0c\u7136\u540e\u4f7f\u7528<code>apt install nginx<\/code>\u5b89\u88c5Nginx\u3002<\/p>\n<\/p>\n<p><h3>2. \u914d\u7f6eNginx<\/h3>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u914d\u7f6eNginx\u4ee5\u6307\u5411\u60a8\u7684\u7f51\u7ad9\u76ee\u5f55\u3002<\/p>\n<\/p>\n<p><pre><code>sudo nano \/etc\/nginx\/sites-available\/your_domain<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6253\u5f00\u7684\u6587\u4ef6\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code>server {<\/p>\r\n<p>    listen 80;<\/p>\r\n<p>    server_name your_domain;<\/p>\r\n\r\n<p>    root \/var\/www\/your_domain;<\/p>\r\n\r\n<p>    index index.html index.htm index.php;<\/p>\r\n\r\n<p>    location \/ {<\/p>\r\n<p>        try_files $uri $uri\/ \/index.php?$query_string;<\/p>\r\n<p>    }<\/p>\r\n\r\n<p>    location ~ \\.php$ {<\/p>\r\n<p>        include snippets\/fastcgi-php.conf;<\/p>\r\n<p>        fastcgi_pass unix:\/var\/run\/php\/php7.4-fpm.sock;  \u6839\u636e\u60a8\u7684PHP\u7248\u672c\u4fee\u6539<\/p>\r\n<p>        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<\/p>\r\n<p>    }<\/p>\r\n<p>}<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u89e3\u91ca\uff1a<\/strong>\u914d\u7f6e\u6587\u4ef6\u6307\u5b9a\u4e86\u670d\u52a1\u5668\u76d1\u542c\u7aef\u53e3\u3001\u57df\u540d\u3001\u7f51\u7ad9\u6839\u76ee\u5f55\u4ee5\u53ca\u5982\u4f55\u5904\u7406PHP\u8bf7\u6c42\u3002<\/p>\n<\/p>\n<p><h3>3. \u5b89\u88c5Apache\u4f5c\u4e3a\u5907\u7528\u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><p>\u867d\u7136\u6211\u4eec\u7684\u4e3b\u8981Web\u670d\u52a1\u5668\u662fNginx\uff0c\u4f46\u6211\u4eec\u4e5f\u9700\u8981\u5b89\u88c5Apache\u4f5c\u4e3a\u5907\u7528\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt install apache2<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u89e3\u91ca\uff1a<\/strong>\u4f7f\u7528<code>apt install apache2<\/code>\u5b89\u88c5Apache\u3002<\/p>\n<\/p>\n<p><h3>4. \u5b89\u88c5MySQL<\/h3>\n<\/p>\n<p><p>\u73b0\u5728\u6211\u4eec\u9700\u8981\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><strong>\u89e3\u91ca\uff1a<\/strong>\u4f7f\u7528<code>apt install mysql-server<\/code>\u5b89\u88c5MySQL\u3002<\/p>\n<\/p>\n<p><h3>5. \u914d\u7f6ePHP\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5PHP\u53ca\u5176\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><p><strong>\u89e3\u91ca\uff1a<\/strong>\u4f7f\u7528<code>apt install<\/code>\u5b89\u88c5PHP\u548c\u6240\u9700\u6269\u5c55\u3002<\/p>\n<\/p>\n<p><h3>6. \u91cd\u542fNginx\u548cApache<\/h3>\n<\/p>\n<p><p>\u5b8c\u6210\u6240\u6709\u914d\u7f6e\u540e\uff0c\u6211\u4eec\u9700\u8981\u91cd\u542fNginx\u548cApache\u4ee5\u5e94\u7528\u66f4\u6539\u3002<\/p>\n<\/p>\n<p><pre><code>sudo systemctl restart nginx<\/p>\r\n<p>sudo systemctl restart apache2<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u89e3\u91ca\uff1a<\/strong>\u4f7f\u7528<code>systemctl restart<\/code>\u91cd\u542f\u670d\u52a1\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>\u7f51\u7ad9\u65e0\u6cd5\u8bbf\u95ee\u3002<\/li>\n<li><strong>\u539f\u56e0\uff1a<\/strong>\u68c0\u67e5Nginx\u914d\u7f6e\u6587\u4ef6\u4e2d\u662f\u5426\u6709\u8bed\u6cd5\u9519\u8bef\uff0c\u786e\u4fdd\u57df\u540d\u6b63\u786e\u6307\u5411\u670d\u52a1\u5668\u3002<\/li>\n<li><strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong>\u4f7f\u7528<code>sudo nginx -t<\/code>\u6d4b\u8bd5Nginx\u914d\u7f6e\u3002<\/li>\n<\/ul>\n<ul>\n<li><strong>\u95ee\u9898\uff1a<\/strong>PHP\u811a\u672c\u65e0\u6cd5\u6267\u884cMySQL\u67e5\u8be2\u3002<\/li>\n<p>    <strong>\u539f\u56e0\uff1a<\/strong>\u786e\u4fddMySQL\u670d\u52a1\u6b63\u5728\u8fd0\u884c\uff0c\u5e76\u4e14PHP\u7684MySQL\u6269\u5c55\u5df2\u6b63\u786e\u5b89\u88c5\u548c\u914d\u7f6e\u3002<\/li>\n<\/p>\n<li><strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong>\u68c0\u67e5MySQL\u670d\u52a1\u72b6\u6001\uff0c\u4f7f\u7528<code>sudo systemctl status mysql<\/code>\uff0c\u5e76\u786e\u8ba4PHP\u914d\u7f6e\u6587\u4ef6\u4e2d\u6709\u5173MySQL\u7684\u8bbe\u7f6e\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4ee5\u5b9e\u64cd\u4e3a\u5bfc\u5411\uff0c\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u5fb7\u8fc5\u7f51\u7edc\u63d0\u4f9b\u7684\u670d\u52a1\u8fdb\u884c\u7f51\u7ad9\u90e8\u7f72\u3002\u6211\u4eec\u5c06\u89e3\u51b3\u7684\u5173\u952e\u95ee\u9898\u662f\uff1a\u5982\u4f55\u5728\u5fb7\u8fc5\u7f51\u7edc\u7684\u670d\u52a1\u5668\u4e0a\u5feb\u901f\u90e8\u7f72\u4e00\u4e2a\u57fa\u4e8eNginx\u548cMySQL\u7684LAMP\u73af\u5883\u3002 \u64cd\u4f5c\u524d\u7684\u51c6\u5907\u6216\u80cc\u666f\u4ecb\u7ecd \u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u5df2\u7ecf\u62e5\u6709\u4ee5\u4e0b\u51c6&#8230;<\/p>\n","protected":false},"author":2,"featured_media":1128,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[157,234,9],"topic":[],"class_list":["post-1127","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-usdt","tag-nginx","tag-234","tag-9"],"_links":{"self":[{"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/posts\/1127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/comments?post=1127"}],"version-history":[{"count":1,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/posts\/1127\/revisions"}],"predecessor-version":[{"id":1130,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/posts\/1127\/revisions\/1130"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/media\/1128"}],"wp:attachment":[{"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/media?parent=1127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/categories?post=1127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/tags?post=1127"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/topic?post=1127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}