{"id":598,"date":"2020-10-03T01:27:32","date_gmt":"2020-10-02T17:27:32","guid":{"rendered":"<!-- wp:paragraph -->\n<p>\u91c7\u7528LNSP\u914d\u7f6e\uff08Linux + Nginx + Sqlite + PHP\uff09<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading -->\n<h2>1. Nginx<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>sudo apt-get install nginx\uff0c\u5b89\u88c5<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph --"},"modified":"2020-10-03T09:47:47","modified_gmt":"2020-10-03T01:47:47","slug":"%e6%a0%91%e8%8e%93%e6%b4%be-web%e6%9c%8d%e5%8a%a1%e5%99%a8-lnsp","status":"publish","type":"post","link":"https:\/\/blog.francis67.cc\/?p=598","title":{"rendered":"\u6811\u8393\u6d3e Web\u670d\u52a1\u5668 LNSP"},"content":{"rendered":"\n<p>\u91c7\u7528LNSP\u914d\u7f6e\uff08Linux + Nginx + Sqlite + PHP\uff09<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.francis67.cc\/?p=598\/#1_Nginx\" >1. Nginx<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.francis67.cc\/?p=598\/#2_php%E5%92%8Csqlite\" >2. php\u548csqlite<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.francis67.cc\/?p=598\/#3_%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86\" >3. \u53cd\u5411\u4ee3\u7406<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blog.francis67.cc\/?p=598\/#4_nginx%E5%92%8Cphp%E7%9B%B8%E5%85%B3%E6%8C%87%E4%BB%A4\" >4. nginx\u548cphp\u76f8\u5173\u6307\u4ee4<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Nginx\"><\/span>1. Nginx<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>sudo apt-get install nginx\uff0c\u5b89\u88c5<\/p>\n\n\n\n<p>sudo \/etc\/init.d\/nginx start\uff0c\u542f\u52a8\u670d\u52a1<\/p>\n\n\n\n<p>\u4fee\u6539 sudo vim \/etc\/nginx\/sites-available\/default \u5176\u4e2d\u7684\u90e8\u5206\u5185\u5bb9\uff0c\u5176\u4ed6\u4fdd\u6301\u4e0d\u53d8\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>listen \u6539\u4e3a8080\u7aef\u53e3\uff08\u4e3a\u4e86\u9632\u6b62\u548c80\u7aef\u53e3\u51b2\u7a81\uff09<\/li><li>index \u589e\u52a0 index.php<\/li><li>\u53bb\u9664php\u6bb5\u843d\u7684\u90e8\u5206\u6ce8\u91ca<\/li><li>html \u6240\u5728\u9ed8\u8ba4\u8def\u5f84\uff0c root \/var\/www\/html;<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">server {\n    listen 8080 default_server;\n    #listen [::]:8080 default_server;    \n \n    root \/var\/www\/html; \n\n    # Add index.php to the list if you are using PHP \n    index index.php index.html index.htm index.nginx-debian.html; \n\n    server_name _; \n\n    location \/ { \n            # First attempt to serve request as file, then \n            # as directory, then fall back to displaying a 404. \n            try_files $uri $uri\/ =404; \n    } \n\n    # pass PHP scripts to FastCGI server \n    # \n    location ~ \\.php$ { \n            include snippets\/fastcgi-php.conf; \n    # \n    #       # With php-fpm (or other unix sockets): \n            fastcgi_pass unix:\/run\/php\/php7.3-fpm.sock; \n    #       # With php-cgi (or other tcp sockets): \n    #       fastcgi_pass 127.0.0.1:9000; \n    } \n\n    # deny access to .htaccess files, if Apache's document root \n    # concurs with nginx's one \n    # \n    #location ~ \/\\.ht { \n    #       deny all; \n    #} \n}<\/pre>\n\n\n\n<p>sudo \/etc\/init.d\/nginx reload\uff0c\u91cd\u8f7d\u3002<\/p>\n\n\n\n<p>\u8fd9\u65f6\u901a\u8fc7\u7cfb\u7edf\u81ea\u5e26\u7684\u6d4f\u89c8\u5668\u8bbf\u95ee127.0.0.1:8080\uff0c\u53ef\u4ee5\u770b\u89c1nginx\u521d\u59cb\u9875\u9762\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_php%E5%92%8Csqlite\"><\/span>2. php\u548csqlite<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>sudo apt-get install php-fpm php-sqlite3\uff0c\u5b89\u88c5php\u548csqlite3\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f\u4f7f\u7528 php-fpm \u548c php-sqlite3 \u4f5c\u4e3a\u9ed8\u8ba4\u53c2\u6570\uff0c\u53ef\u4ee5\u5b89\u88c5\u6700\u65b0\u7248\u672c\u3002<\/p>\n\n\n\n<p>\u5728html\u6240\u5728\u9ed8\u8ba4\u8def\u5f84\uff0c\u65b0\u5efa\u6587\u4ef6index.php<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php echo phpinfo(); ?&gt;<\/pre>\n\n\n\n<p><strong>\u671f\u95f4\u9047\u5230\u4e86\u4e00\u4e9b\u95ee\u9898\uff0c\u6700\u521d\u4ee5\u4e3a\u662fngnix\u548cphp\u914d\u7f6e\u7684\u95ee\u9898\uff0c\u6700\u540e\u53d1\u73b0\u662f\u56e0\u4e3a\u6700\u521dindex.php\u6587\u4ef6\u91cc\u7684\u8bed\u6cd5\u95ee\u9898\uff0c\u8fd4\u56deHTTP 500\u7684\u9519\u8bef\u3002<br>\u901a\u8fc7\u4fee\u6539sudo vim \/etc\/php\/7.3\/fpm\/php.ini \u6587\u4ef6\u4e2d <span class=\"has-inline-color has-blue-color\">display_errors = On<\/span>\uff0c\u53ef\u4ee5\u663e\u793a\u51fa\u9519\u8bef\u6240\u5728\uff0c\u8fdb\u884c\u4fee\u6b63\u3002<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86\"><\/span>3. \u53cd\u5411\u4ee3\u7406<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4f7f\u7528frp\u4f5c\u4e3a\u5185\u7f51\u7a7f\u900f\uff0c\u56e0\u4e3a\u6ca1\u6709\u591a\u4f59\u7684\u57df\u540d\uff0c\u53ea\u80fd\u901a\u8fc7IP\u8bbf\u95ee\uff0c\u6240\u4ee5\u5728frpc.ini \u4e2d\u6dfb\u52a0<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Web]\ntype = tcp\nlocal_ip = 127.0.0.1\nlocal_port = 8080\nremote_port = [remote_port]<\/pre>\n\n\n\n<p>\u4f7f\u7528frp\u7684 server_IP:[remote_port]\u5373\u53ef\u4ee5\u4ece\u5916\u7f51\u8bbf\u95ee\u5904\u4e8e\u5185\u7f51\u4e0a\u7684\u6811\u8393\u6d3e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_nginx%E5%92%8Cphp%E7%9B%B8%E5%85%B3%E6%8C%87%E4%BB%A4\"><\/span>4. nginx\u548cphp\u76f8\u5173\u6307\u4ee4<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre id=\"block-4a66e5b3-3aa3-48d3-a602-2a347fc5d72d\" class=\"wp-block-preformatted\">\/etc\/init.d\/php-fpm7.3 {start|stop|status|restart|reload|force-reload}<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">nginx {start|stop|restart|reload|force-reload|status|configtest|rotate|upgrade}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u91c7\u7528LNSP\u914d\u7f6e\uff08Linux + Nginx + Sqlite + PHP\uff09 1. Nginx sudo ap [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[97,93,212,214,213,211],"class_list":["post-598","post","type-post","status-publish","format-standard","hentry","category-vpslog","tag-nginx","tag-php","tag-raspberry-pi","tag-sqlite","tag-web","tag-211"],"_links":{"self":[{"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/posts\/598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=598"}],"version-history":[{"count":17,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/posts\/598\/revisions"}],"predecessor-version":[{"id":616,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/posts\/598\/revisions\/616"}],"wp:attachment":[{"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}