{"id":588,"date":"2023-04-15T17:02:28","date_gmt":"2023-04-15T09:02:28","guid":{"rendered":"http:\/\/www.huerpu.cc:7000\/?p=588"},"modified":"2023-04-15T17:02:28","modified_gmt":"2023-04-15T09:02:28","slug":"pve%e7%b3%bb%e5%88%97%e6%95%99%e7%a8%8b%e5%8d%81%e4%b9%9d%e3%80%81ubuntu22-04%e4%bd%bf%e7%94%a8nginx%e9%85%8d%e7%bd%aechevereto%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"http:\/\/www.huerpu.cc:7000\/?p=588","title":{"rendered":"PVE\u7cfb\u5217\u6559\u7a0b(\u5341\u4e5d)\u3001ubuntu22.04\u4f7f\u7528Nginx\u914d\u7f6echevereto\u670d\u52a1\u5668"},"content":{"rendered":"<h3>PVE\u7cfb\u5217\u6559\u7a0b(\u5341\u4e5d)\u3001ubuntu22.04\u4f7f\u7528Nginx\u914d\u7f6echevereto\u670d\u52a1\u5668<\/h3>\n<p>\u4e3a\u4e86\u66f4\u597d\u7684\u6d4f\u89c8\u4f53\u9a8c\uff0c\u6b22\u8fce\u5149\u987e<a href=\"http:\/\/www.huerpu.cc:7000\/\">\u52e4\u594b\u7684\u51ef\u5c14\u68ee\u540c\u5b66\u4e2a\u4eba\u535a\u5ba2http:\/\/www.huerpu.cc:7000<\/a><\/p>\n<h3>\u4e00\u3001\u73af\u5883\u8bf4\u660e<\/h3>\n<p>\u8fd9\u91cc\u4f7f\u7528\u7684\u662fUbuntu22.04\uff0cmysql8\u5df2\u7ecf\u5728\u5176\u4ed6\u670d\u52a1\u5668\u5b89\u88c5\u597d\u4e86\uff0c\u5982\u679c\u9700\u8981\u53ef\u4ee5\u67e5\u770b\u4e0a\u9762\u7684\u6559\u7a0b\u3002chevereto\u4f7f\u7528\u7684V3\u6700\u65b0\u7248\u3002<\/p>\n<h3>\u4e8c\u3001\u5b89\u88c5Nginx<\/h3>\n<pre><code class=\"language-shell\">#\u5207\u6362\u5230root\nsudo su -\n\n#\u66f4\u65b0\napt update \napt upgrade -y\n\n#\u5b89\u88c5nginx\napt install nginx -y\n\n#\u9632\u706b\u5899\u653e\u884cNginx\nufw allow &#039;Nginx Full&#039;\nufw enable\nufw status <\/code><\/pre>\n<h3>\u4e09\u3001\u5b89\u88c5php7.4<\/h3>\n<pre><code class=\"language-shell\">#\u6dfb\u52a0\u6e90\nadd-apt-repository ppa:ondrej\/php\n# \u7136\u540e\u56de\u8f66\u5373\u53ef\n\n#\u5b89\u88c5php\u76f8\u5173\u8f6f\u4ef6\napt install php7.4 php7.4-bcmath php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-fpm php7.4-enchant php7.4-gd php7.4-json php7.4-mysql  php7.4-mbstring php7.4-xml php7.4-zip -y<\/code><\/pre>\n<h3>\u56db\u3001\u914d\u7f6echevereto\u9759\u6001\u6587\u4ef6<\/h3>\n<pre><code class=\"language-shell\">#\u5b89\u88c5zip\u89e3\u538b\u7f29\u8f6f\u4ef6\napt install unzip\n\n#\u628achevereto\u538b\u7f29\u5305\u4f20\u5165\u670d\u52a1\u5668\uff0c\u6211\u8fd9\u91cc\u4f7f\u7528\u7684\u662fMobaXterm\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528wget\u7b49\u65b9\u5f0f\n\n#\u8fdb\u5165\u5230\u8fd9\u4e2a\u76ee\u5f55\uff0c\u4e3a\u4e86\u628a\u6587\u4ef6\u89e3\u538b\u5230\u6b64\u5904\ncd \/var\/www\/html\n\n#\u89e3\u538bchevereto\u6587\u4ef6\nunzip Chevereto.zip\n\n#\u4fee\u6539\u6587\u4ef6\u5939\u540d\u79f0\u4e3achevereto\nmv Chevereto\/ chevereto\/\n\n#\u628achevereto\u53ca\u5176\u4e0b\u9762\u6240\u6709\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u8d4b\u4e88\u6700\u9ad8\u6743\u9650777\nchdmod -R 777 chevereto\n\n#\u4fee\u6539\u6570\u636e\u5e93\u914d\u7f6e\ncd chevereto\ncd app\nvim settings.php\n\n#\u4fee\u6539settings.php\u7684\u5185\u5bb9\u5982\u4e0b\n&lt;?php\n$settings = array (\n  &#039;db_host&#039; =&gt; &#039;192.168.1.97:3306&#039;,\n  &#039;db_name&#039; =&gt; &#039;hep_chevereto&#039;,\n  &#039;db_user&#039; =&gt; &#039;root&#039;,\n  &#039;db_pass&#039; =&gt; &#039;admin123*&#039;,\n  &#039;db_table_prefix&#039; =&gt; &#039;hep_&#039;,\n  &#039;db_driver&#039; =&gt; &#039;mysql&#039;,\n  &#039;db_pdo_attrs&#039; =&gt;\n  array (\n  ),\n  &#039;debug_level&#039; =&gt; 1,\n);<\/code><\/pre>\n<h3>\u4e94\u3001\u914d\u7f6enginx<\/h3>\n<pre><code class=\"language-shell\">#\u4fee\u6539nginx\u9ed8\u8ba4\u6587\u4ef6\nvim \/etc\/nginx\/sites-available\/default<\/code><\/pre>\n<p>\u4fee\u6539\u5185\u5bb9\u5982\u4e0b<\/p>\n<pre><code class=\"language-shell\">#\u4fee\u6539\u5230\/var\/www\/html\/chevereto\/\nroot \/var\/www\/html\/chevereto\/;\n\n# \u6700\u540e\u4e00\u4e2a\u6539\u6210index.php\nindex index.html index.htm index.php;\n\nserver_name _;\n\n#\u6ce8\u91ca\u6389404\uff0c\u5e76\u6dfb\u52a0\u4e00\u884ctry_files $uri $uri\/ \/index.php?$query_string;\nlocation \/ {\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        try_files $uri $uri\/ \/index.php?$query_string;\n}\n\n#\u4e0b\u9762\u51e0\u4e2a\u90fd\u662f\u65b0\u589e\u7684\n# Image not found replacement\nlocation ~* (jpe?g|png|gif) {\n        log_not_found off;\n        error_page 404 \/content\/images\/system\/default\/404.gif;\n}\n\n# CORS header (avoids font rendering issues)\nlocation ~ \\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {\n        add_header Access-Control-Allow-Origin &quot;*&quot;;\n}\n\n# pass PHP scripts to FastCGI server\nlocation ~ \\.php$ {\n        include snippets\/fastcgi-php.conf;\n        fastcgi_pass unix:\/run\/php\/php7.4-fpm.sock;\n}     <\/code><\/pre>\n<p>\u6d4b\u8bd5\u4e00\u4e0bnginx\u6587\u4ef6\u914d\u7f6e\u662f\u5426\u6b63\u786e<\/p>\n<pre><code class=\"language-shell\">nginx -t<\/code><\/pre>\n<p>\u56e0\u4e3a\u6211\u4eec\u4e00\u76f4\u90fd\u662froot\u767b\u5f55\u5e76\u505a\u7684\u4fee\u6539\uff0c\u7528\u4f5cweb\u8bbf\u95ee\u7684\u65f6\u5019www-data\u7528\u6237\u7ec4\u6ca1\u6709\u6743\u9650\uff0c\u53ef\u4ee5\u7528chmod\u66f4\u6539\u6587\u4ef6\u5939\u6743\u9650<\/p>\n<p><code>chown -R www-data:www-data chevereto\/<\/code>\u4e2dchown\u662f\u66f4\u6539\u6743\u9650\u547d\u4ee4\uff0c-R\u8868\u793a\u9012\u5f52\uff0cwww-data:www-data\u8868\u793a\u66f4\u6539\u7684\u76ee\u6807\u7528\u6237\u7ec4\u548c\u7528\u6237\uff0cchevereto\/\u662f\u66f4\u6539\u7684\u76ee\u6807\u6587\u4ef6\u5939\uff0c\u4e5f\u5c31\u662f\/var\/www\/html\/chevereto\u3002<\/p>\n<pre><code class=\"language-shell\">#www-data\u6307\u7684\u662fapache2\u6216nginx\u4f3a\u670d\u5668\u80fd\u8bfb\u7684\u8d26\u53f7\u4ee5\u53ca\u7fa4\u7ec4\ncd \/var\/www\/html\nchown -R www-data:www-data chevereto\/\n\n#\u91cd\u542fnginx\u548cphp\u670d\u52a1\nsystemctl restart nginx\nsystemctl restart php7.4-fpm\n#\u6216\u8005\u4f7f\u7528\nservice nginx start\nservice php7.4-fpm start<\/code><\/pre>\n<p>\u5907\u6ce8\uff1a\u4fee\u6539\u7aef\u53e3\u53f7<\/p>\n<pre><code class=\"language-shell\">#\u628a80\u6539\u6210\u81ea\u5df1\u60f3\u8981\u7684\u5373\u53ef\nvim \/etc\/nginx\/sites-available\/default<\/code><\/pre>\n<h3>\u516d\u3001\u8bbf\u95ee\u5e76\u5b89\u88c5chevereto<\/h3>\n<p>\u5728\u6d4f\u89c8\u5668\u8f93\u5165chevereto\u670d\u52a1\u5668ip\u5730\u5740\uff0c\u5373\u53ef\u51fa\u73b0\u914d\u7f6e\u9875\u9762\u3002<\/p>\n<h3>\u4e03\u3001\u4fee\u6539\u4e0a\u4f20\u6587\u4ef6\u5927\u5c0f\u9650\u5236<\/h3>\n<ul>\n<li><strong>\u4fee\u6539php\u7684upload\u53c2\u6570<\/strong><\/li>\n<\/ul>\n<p>\u7ed9\u51fa\u5b98\u65b9\u6587\u6863\u7684\u53c2\u6570\u8bf4\u660e\uff0c\u6211\u4eec\u53ea\u4fee\u6539\u4e24\u4e2a\u53c2\u6570post_max_size\u3001upload_max_filesize\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2023\/04\/15\/multiphp-ini-keys.83901b7f.png\" alt=\"multiphp-ini-keys.83901b7f\" \/><\/p>\n<pre><code class=\"language-shell\"># \u4fee\u6539\u4e0b\u9762\u8fd9\u4e24\u4e2a\u6587\u4ef6\uff0c\u628apost_max_size\u3001upload_max_filesize\u6309\u81ea\u5df1\u7684\u9700\u8981\u90fd\u8c03\u5927\nvim \/etc\/php\/7.4\/cli\/php.ini\nvim \/etc\/php\/7.4\/fpm\/php.ini\n\n#\u53ef\u4ee5\u8f93\u5165\/\u8fdb\u884c\u641c\u7d22\npost_max_size = 1024M\nupload_max_filesize = 512M<\/code><\/pre>\n<ul>\n<li><strong>\u4fee\u6539nginx\u7684upload\u53c2\u6570<\/strong><\/li>\n<\/ul>\n<pre><code class=\"language-shell\">#\u4fee\u6539nginx\u7684upload\u4e0a\u4f20\u5927\u5c0f\u9650\u5236\nfind \/ -name nginx.conf\nvim \/etc\/nginx\/nginx.conf\n#\u65b0\u589e\u4e0b\u9762\u4e24\u9879\nclient_body_buffer_size 2048M;\nclient_max_body_size 1024M;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PVE\u7cfb\u5217\u6559\u7a0b(\u5341\u4e5d)\u3001ubuntu22.04\u4f7f\u7528Nginx\u914d\u7f6echevereto\u670d\u52a1\u5668 \u4e3a\u4e86\u66f4\u597d\u7684\u6d4f\u89c8\u4f53\u9a8c\uff0c [&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":[],"class_list":["post-588","post","type-post","status-publish","format-standard","hentry","category-pve"],"_links":{"self":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts\/588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=588"}],"version-history":[{"count":1,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts\/588\/revisions"}],"predecessor-version":[{"id":589,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts\/588\/revisions\/589"}],"wp:attachment":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=588"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}