{"id":1191,"date":"2026-01-05T18:40:17","date_gmt":"2026-01-05T10:40:17","guid":{"rendered":"http:\/\/www.max-shu.com\/blog\/?p=1191"},"modified":"2026-01-05T18:40:19","modified_gmt":"2026-01-05T10:40:19","slug":"%e6%8a%96%e5%ba%97%e4%ba%91%e7%9a%84%e8%99%9a%e6%9c%ba%e7%94%a8nginx%e4%bb%a3%e7%90%86%e8%a7%a3%e7%a0%81%e6%8a%96%e5%ba%97%e8%ae%a2%e5%8d%95","status":"publish","type":"post","link":"http:\/\/www.max-shu.com\/blog\/?p=1191","title":{"rendered":"\u6296\u5e97\u4e91\u7684\u865a\u673a\u7528Nginx\u4ee3\u7406\u89e3\u7801\u6296\u5e97\u8ba2\u5355"},"content":{"rendered":"\n<p>\u5b89\u88c5ngnix\uff1a\u7565<\/p>\n\n\n\n<p>\u914d\u7f6enginx\uff1a<\/p>\n\n\n\n<p># cat \/etc\/nginx\/nginx.conf<\/p>\n\n\n\n<p>user nginx;<\/p>\n\n\n\n<p>worker_processes &nbsp;8;<\/p>\n\n\n\n<p>error_log \/var\/log\/nginx\/error.log;<\/p>\n\n\n\n<p>pid \/run\/nginx.pid;<\/p>\n\n\n\n<p>events {<\/p>\n\n\n\n<p>&nbsp; &nbsp; worker_connections &nbsp;65535;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>http {<\/p>\n\n\n\n<p>&nbsp; &nbsp; log_format &nbsp;main &nbsp;&#8216;$remote_addr &#8211; $remote_user [$time_local] &#8220;$request&#8221; &#8216;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8216;$status $body_bytes_sent &#8220;$http_referer&#8221; &#8216;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8216;&#8221;$http_user_agent&#8221; &#8220;$http_x_forwarded_for&#8221;&#8216;;<\/p>\n\n\n\n<p>&nbsp; &nbsp; access_log &nbsp;\/var\/log\/nginx\/access.log &nbsp;main;<\/p>\n\n\n\n<p>&nbsp; &nbsp; sendfile &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on;<\/p>\n\n\n\n<p>&nbsp; &nbsp; tcp_nopush &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on;<\/p>\n\n\n\n<p>&nbsp; &nbsp; tcp_nodelay &nbsp; &nbsp; &nbsp; &nbsp; on;<\/p>\n\n\n\n<p>&nbsp; &nbsp; keepalive_timeout &nbsp; 65;<\/p>\n\n\n\n<p>&nbsp; &nbsp; types_hash_max_size 4096;<\/p>\n\n\n\n<p>&nbsp; &nbsp; include &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/etc\/nginx\/mime.types;<\/p>\n\n\n\n<p>&nbsp; &nbsp; default_type &nbsp; &nbsp; &nbsp; &nbsp;application\/octet-stream;<\/p>\n\n\n\n<p>&nbsp; &nbsp; #gzip &nbsp;on;<\/p>\n\n\n\n<p>&nbsp; &nbsp; proxy_buffering &nbsp; &nbsp;off;<\/p>\n\n\n\n<p>&nbsp; &nbsp; proxy_buffer_size &nbsp;128k;<\/p>\n\n\n\n<p>&nbsp; &nbsp; proxy_buffers 100 &nbsp;128k;<\/p>\n\n\n\n<p>&nbsp; &nbsp; client_max_body_size 1024m;<\/p>\n\n\n\n<p>&nbsp; &nbsp; upstream doudianapi {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; server openapi-fxg.jinritemai.com:443;<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; log_format upstream_info &#8216;$remote_addr &#8211; $remote_user [$time_local] &#8220;$request&#8221; &#8216;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8216;$status $body_bytes_sent &#8220;$http_referer&#8221; &#8216;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8216;&#8221;$http_user_agent&#8221; &#8220;$upstream_addr&#8221; &#8216;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8216;$upstream_response_time $request_time&#8217;;<\/p>\n\n\n\n<p>&nbsp; &nbsp; server {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; listen 443 ssl;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; listen [::]:443 ssl;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; server_name doudian.yunbu.me;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ssl_certificate &#8220;\/etc\/nginx\/cert\/yunbu.me_bundle.crt&#8221;;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ssl_certificate_key &#8220;\/etc\/nginx\/cert\/yunbu.me.key&#8221;;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ssl_protocols TLSv1.2 TLSv1.3;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-SHA256:AES256-SHA256;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ssl_prefer_server_ciphers off;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ssl_session_cache shared:SSL:10m;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ssl_session_timeout 10m;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; # Load configuration files for the default server block.<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; # include \/etc\/nginx\/default.d\/*.conf;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; location \/ {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_http_version 1.1;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_pass https:\/\/openapi-fxg.jinritemai.com;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_ssl_server_name on;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_set_header Host openapi-fxg.jinritemai.com;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_set_header User-Agent $http_user_agent;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; access_log \/var\/log\/nginx\/access.log upstream_info;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; error_page 404 \/404.html;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location = \/40x.html {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; error_page 500 502 503 504 \/50x.html;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location = \/50x.html {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>\u542f\u52a8\uff1a<\/p>\n\n\n\n<p>systemctl start nginx<\/p>\n\n\n\n<p>\u6ce8\u610f\uff1a\u5b89\u5168\u7ec4\u5f00\u653e443\u7aef\u53e3<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5ngnix\uff1a\u7565 \u914d\u7f6enginx\uff1a # cat \/etc\/nginx\/nginx.conf user ngi &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[946,944,945,948,947],"class_list":["post-1191","post","type-post","status-publish","format-standard","hentry","category-4","tag-nginx","tag-944","tag-945","tag-948","tag-947"],"views":135,"_links":{"self":[{"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1191"}],"version-history":[{"count":1,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1191\/revisions"}],"predecessor-version":[{"id":1192,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1191\/revisions\/1192"}],"wp:attachment":[{"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1191"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}