{"id":146,"date":"2022-07-01T17:26:52","date_gmt":"2022-07-01T09:26:52","guid":{"rendered":"https:\/\/wpeyes.com\/wordpress\/?post_type=docs&#038;p=146"},"modified":"2022-07-01T17:27:00","modified_gmt":"2022-07-01T09:27:00","slug":"nginx","status":"publish","type":"docs","link":"https:\/\/wpeyes.com\/wordpress\/docs\/nginx","title":{"rendered":"Nginx"},"content":{"rendered":"\n<p>\u867d\u7136 LAMP \u5806\u6808\uff08Linux + Apache + MySQL + PHP\uff09\u5728\u652f\u6301 WordPress \u65b9\u9762\u975e\u5e38\u6d41\u884c\uff0c\u4f46\u4e5f\u53ef\u4ee5\u4f7f\u7528 Nginx\u3002WordPress \u652f\u6301 Nginx\uff0c\u4e00\u4e9b\u5927\u578b WordPress \u7f51\u7ad9\uff0c\u4f8b\u5982 WordPress.com\uff0c\u90fd\u662f\u7531 Nginx \u63d0\u4f9b\u652f\u6301\u7684\u3002<\/p>\n\n\n\n<p>\u8c08\u5230 Nginx \u65f6\uff0c\u91cd\u8981\u7684\u662f\u8981\u77e5\u9053 Nginx \u6709\u591a\u79cd\u5b9e\u73b0\u65b9\u5f0f\u3002\u5b83\u53ef\u4ee5\u8bbe\u7f6e\u4e3a Apache \u524d\u9762\u7684\u53cd\u5411\u4ee3\u7406\uff0c\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u8bbe\u7f6e\uff0c\u5141\u8bb8\u60a8\u4f7f\u7528 Apache \u7684\u6240\u6709\u529f\u80fd\u548c\u529f\u80fd\uff0c\u540c\u65f6\u53d7\u76ca\u4e8e Nginx \u7684\u901f\u5ea6\u3002\u5927\u591a\u6570\u62a5\u544a\u4f7f\u7528 Nginx \u4f5c\u4e3a\u670d\u52a1\u5668\u7684\u7f51\u7ad9\uff08\u57fa\u4e8e\u4ece HTTP \u54cd\u5e94\u6807\u5934\u6536\u96c6\u7684\u7edf\u8ba1\u4fe1\u606f\uff09\u5b9e\u9645\u4e0a\u662f\u4f7f\u7528 Nginx \u4f5c\u4e3a\u53cd\u5411\u4ee3\u7406\u8fd0\u884c\u7684 Apache\u3002\uff08\u663e\u793a\u201cNginx\u201d\u7684 HTTP \u54cd\u5e94\u6807\u5934\u662f\u7531\u53cd\u5411\u4ee3\u7406\u62a5\u544a\u7684\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u672c\u8eab\u3002\uff09<\/p>\n\n\n\n<p><strong>\u672c\u6307\u5357\u6307\u7684\u662f<em>\u72ec\u7acb\u7684 Nginx<\/em>\u8bbe\u7f6e\uff0c\u5b83\u7528\u4f5c\u4e3b\u670d\u52a1\u5668<em>\u800c\u4e0d\u662f<\/em>Apache\u3002<\/strong>\u5e94\u8be5\u6ce8\u610f\u7684\u662f\uff0cNginx \u5e76\u4e0d\u662f Apache \u7684\u5b8c\u5168\u53ef\u4e92\u6362\u7684\u66ff\u4ee3\u54c1\u3002\u5728\u7ee7\u7eed\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u4e86\u89e3\u5f71\u54cd WordPress \u5b9e\u65bd\u7684\u4e00\u4e9b\u5173\u952e\u5dee\u5f02\uff1a<\/p>\n\n\n\n<ul><li>\u4f7f\u7528 Nginx \u6ca1\u6709\u76ee\u5f55\u7ea7\u522b\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5982 Apache \u7684 .htaccess \u6216 IIS \u7684 web.config \u6587\u4ef6\u3002\u6240\u6709\u914d\u7f6e\u90fd\u5fc5\u987b\u7531\u7ba1\u7406\u5458\u5728\u670d\u52a1\u5668\u7ea7\u522b\u5b8c\u6210\uff0c\u5e76\u4e14<em>WordPress \u4e0d\u80fd<\/em>\u50cf Apache \u6216 IIS \u90a3\u6837\u4fee\u6539\u914d\u7f6e\u3002<\/li><li>\u8fd0\u884c Nginx \u65f6\uff0cPretty Permalinks \u529f\u80fd\u7565\u6709\u4e0d\u540c\u3002<\/li><li>\u7531\u4e8e Nginx \u6ca1\u6709 .htaccess-type \u80fd\u529b\uff0c\u800c\u4e14 WordPress \u65e0\u6cd5\u81ea\u52a8\u4e3a\u60a8\u4fee\u6539\u670d\u52a1\u5668\u914d\u7f6e\uff0c\u56e0\u6b64\u65e0\u6cd5\u4e3a\u60a8\u751f\u6210\u91cd\u5199\u89c4\u5219\u3002<\/li><li>\u5728\u4e0d\u4fee\u6539\u60a8\u7684\u5b89\u88c5\u7684\u60c5\u51b5\u4e0b\uff0c\u201cindex.php\u201d\u5c06\u88ab\u6dfb\u52a0\u5230\u60a8\u7684\u6c38\u4e45\u94fe\u63a5\u4e2d\u3002\uff08\u6709\u4e00\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u901a\u8fc7\u63d2\u4ef6\uff08\u89c1\u4e0b\u6587\uff09\u548c\/\u6216\u5411\u60a8\u7684\u5b50\u4e3b\u9898\u7684 functions.php \u6dfb\u52a0\u81ea\u5b9a\u4e49\u4ee3\u7801\u6765\u7f13\u89e3\u8fd9\u79cd\u60c5\u51b5\u3002\uff09<\/li><li>\u4f46\u662f\uff0c\u5982\u679c\u60a8\u786e\u5b9e\u60f3\u62e5\u6709\u4e00\u4e9b\uff08\u6709\u9650\u7684\uff09 .htaccess \u529f\u80fd\uff0c\u5728\u6280\u672f\u4e0a\u53ef\u4ee5\u901a\u8fc7\u5b89\u88c5<a href=\"http:\/\/php.net\/manual\/en\/book.htscanner.php\">PHP \u7684 htscanner PECL \u6269\u5c55\u6765<\/a>\u6dfb\u52a0\u3002\uff08\u4f46\u662f\uff0c\u8fd9\u4e0d\u662f\u4e00\u4e2a\u5b8c\u7f8e\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u56e0\u6b64\u8bf7\u52a1\u5fc5\u5728\u73b0\u573a\u4f7f\u7528\u4e4b\u524d\u5f7b\u5e95\u6d4b\u8bd5\u548c\u8c03\u8bd5\u3002\uff09<\/li><\/ul>\n\n\n\n<p>\u672c\u6307\u5357<strong>\u4e0d\u4f1a\u4ecb\u7ecd<\/strong>\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6e Nginx\uff0c\u56e0\u6b64\u5047\u8bbe\u60a8\u5df2\u7ecf\u5b89\u88c5\u4e86 Nginx\uff0c\u5e76\u4e14\u5bf9\u5982\u4f55\u4f7f\u7528\u548c\u8c03\u8bd5\u5b83\u6709\u57fa\u672c\u7684\u4e86\u89e3\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"generic-and-multi-site-support\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#generic-and-multi-site-support\">\u901a\u7528\u548c\u591a\u7ad9\u70b9\u652f\u6301<\/a><\/h2>\n\n\n\n<p>\u8981\u4f7f WordPress \u4e0e Nginx \u4e00\u8d77\u5de5\u4f5c\uff0c\u60a8\u5fc5\u987b\u914d\u7f6e\u540e\u7aef php-cgi\u3002\u53ef\u7528\u7684\u9009\u9879\u662f\u201cfastcgi\u201d\u6216\u201cphp-fpm\u201d\u3002\u8fd9\u91cc\u4f7f\u7528\u4e86 php-fpm\uff0c\u56e0\u4e3a\u5b83\u5305\u542b\u5728 PHP 5.3+ \u4e2d\uff0c\u6240\u4ee5\u5b89\u88c5\u8d77\u6765\u5f88\u7b80\u5355\u3002<\/p>\n\n\n\n<p>Nginx \u914d\u7f6e\u5df2\u5206\u89e3\u4e3a\u4e94\u4e2a\u4e0d\u540c\u7684\u6587\u4ef6\uff0c\u5e76\u8fdb\u884c\u4e86\u5927\u91cf\u6ce8\u91ca\u4ee5\u4f7f\u6bcf\u4e2a\u9009\u9879\u66f4\u6613\u4e8e\u7406\u89e3\u3002\u4f5c\u8005\u8fd8\u5c3d\u6700\u5927\u52aa\u529b\u5c1d\u8bd5\u9075\u5faa nginx \u914d\u7f6e\u7684\u201c\u6700\u4f73\u5b9e\u8df5\u201d&nbsp;<a href=\"https:\/\/wordpress.org\/support\/profile\/bigsite\">\u3002<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"main-generic-startup-file\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#main-generic-startup-file\">\u4e3b\uff08\u901a\u7528\uff09\u542f\u52a8\u6587\u4ef6<\/a><\/h3>\n\n\n\n<p>\u8fd9\u7b49\u4ef7\u4e8e \/etc\/nginx\/nginx.conf\uff08\u6216\u8005 \/etc\/nginx\/conf\/nginx.conf\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f Arch Linux\uff09\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234567891011121314151617181920212223242526272829303132333435363738394041<\/td><td><code># Generic startup file.<\/code><code>user {user} {group};<\/code>&nbsp;<code>#usually equal to number of CPUs you have. run command \"grep processor \/proc\/cpuinfo | wc -l\" to find it<\/code><code>worker_processes&nbsp; auto;<\/code><code>worker_cpu_affinity auto;<\/code>&nbsp;<code>error_log&nbsp; \/var\/log\/nginx\/error.log;<\/code><code>pid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/var\/run\/nginx.pid;<\/code>&nbsp;<code># Keeps the logs free of messages about not being able to bind().<\/code><code>#daemon&nbsp;&nbsp;&nbsp;&nbsp; off;<\/code>&nbsp;<code>events {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>worker_connections&nbsp; 1024;<\/code><code>}<\/code>&nbsp;<code>http {<\/code><code>#&nbsp;&nbsp; rewrite_log on;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>include mime.types;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>default_type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; application\/octet-stream;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/var\/log\/nginx\/access.log;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>sendfile&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on;<\/code><code>#&nbsp;&nbsp; tcp_nopush&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>keepalive_timeout&nbsp; 3;<\/code><code>#&nbsp;&nbsp; tcp_nodelay&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on;<\/code><code>#&nbsp;&nbsp; gzip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#php max upload limit cannot be larger than this&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>client_max_body_size 13m;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>index&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index.php index.html index.htm;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># Upstream to abstract backend connection(s) for PHP.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>upstream php {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#this should match value of \"listen\" directive in php-fpm pool<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>server unix:\/tmp\/php-fpm.sock;<\/code><code>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server 127.0.0.1:9000;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>include sites-enabled\/*;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u8fd9\u4e0e\u6807\u51c6\u7684 nginx.conf \u6587\u4ef6\u6709\u70b9\u4e0d\u540c\u3002\u6b64\u914d\u7f6e\u9075\u5faa Ubuntu\/Debian \u58f0\u660e\u542f\u7528\u7ad9\u70b9\u7684\u65b9\u6cd5\u4ee5\u83b7\u5f97\u6700\u5927\u7684\u7075\u6d3b\u6027\u2014\u2014\u4f7f\u7528\u201csites-available\u201d\u6765\u5b58\u50a8\u914d\u7f6e\uff0c\u7136\u540e\u4ece\u201csites-enabled\u201d\u7b26\u53f7\u94fe\u63a5\u5230\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"per-site-configuration\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#per-site-configuration\">\u6bcf\u4e2a\u7ad9\u70b9\u914d\u7f6e<\/a><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12345678910111213141516171819202122<\/td><td><code># Redirect everything to the main site. We use a separate server statement and NOT an if statement - see http:\/\/wiki.nginx.org\/IfIsEvil<\/code>&nbsp;<code>server {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>server_name&nbsp; _;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>return<\/code> <code>302 $scheme:<\/code><code>\/\/example<\/code><code>.com$request_uri;<\/code><code>}<\/code>&nbsp;<code>server {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>server_name example.com;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>root <\/code><code>\/var\/www\/example<\/code><code>.com;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>index index.php;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>include global<\/code><code>\/restrictions<\/code><code>.conf;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># Additional rules go here.<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># Only include one of the files below.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>include global<\/code><code>\/wordpress<\/code><code>.conf;<\/code><code>#&nbsp;&nbsp;&nbsp; include global\/wordpress-ms-subdir.conf;<\/code><code>#&nbsp;&nbsp;&nbsp; include global\/wordpress-ms-subdomain.conf;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u5c06\u914d\u7f6e\u7684\u90e8\u5206\u62c6\u5206\u4e3a\u591a\u4e2a\u6587\u4ef6\u5141\u8bb8\u53cd\u590d\u91cd\u7528\u76f8\u540c\u7684\u903b\u8f91\u3002\u201c\u5168\u5c40\u201d\u5b50\u76ee\u5f55\u7528\u4e8e\u6dfb\u52a0\u989d\u5916\u7684\u901a\u7528\u89c4\u5219\uff08\/etc\/nginx\/conf\/global\/ \u6216 \/etc\/nginx\/global\/ \u53d6\u51b3\u4e8e\u60a8\u7684 nginx \u5b89\u88c5\u65b9\u5f0f\uff09\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"global-restrictions-file\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#global-restrictions-file\">\u5168\u5c40\u9650\u5236\u6587\u4ef6<\/a><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12345678910111213141516171819202122232425<\/td><td><code># Global restrictions configuration file.<\/code><code># Designed to be included in any server {} block.<\/code><code>location = <\/code><code>\/favicon<\/code><code>.ico {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>log_not_found off;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log off;<\/code><code>}<\/code>&nbsp;<code>location = <\/code><code>\/robots<\/code><code>.txt {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>allow all;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>log_not_found off;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log off;<\/code><code>}<\/code>&nbsp;<code># Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).<\/code><code># Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)<\/code><code>location ~ \/\\. {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>deny all;<\/code><code>}<\/code>&nbsp;<code># Deny access to any files with a .php extension in the uploads directory<\/code><code># Works in sub-directory installs and also in multisite network<\/code><code># Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)<\/code><code>location ~* \/(?:uploads|files)\/.*\\.php$ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>deny all;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"general-wordpress-rules\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#general-wordpress-rules\">\u4e00\u822c WordPress \u89c4\u5219<\/a><\/h3>\n\n\n\n<p>\u5bf9\u4e8e\u5355\u7ad9\u70b9\u5b89\u88c5\uff0c\u8fd9\u91cc\u662f\u201cglobal\/wordpress.conf\u201d\u6587\u4ef6\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>123456789101112131415161718192021222324252627282930313233343536373839404142434445<\/td><td><code># WordPress single site rules.<\/code><code># Designed to be included in any server {} block.<\/code><code># Upstream to abstract backend connection(s) for php<\/code><code>upstream php {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>server unix:<\/code><code>\/tmp\/php-cgi<\/code><code>.socket;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>server 127.0.0.1:9000;<\/code><code>}<\/code>&nbsp;<code>server {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>## Your website name goes here.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>server_name domain.tld;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>## Your only path reference.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>root <\/code><code>\/var\/www\/wordpress<\/code><code>;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>## This should be in your http block and if it is, it's not needed here.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>index index.php;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location = <\/code><code>\/favicon<\/code><code>.ico {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>log_not_found off;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log off;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location = <\/code><code>\/robots<\/code><code>.txt {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>allow all;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>log_not_found off;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log off;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location \/ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># This is cool because no php is touched for static content.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># include the \"?$args\" part so non-default permalinks doesn't break when using query string<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files $uri $uri\/ <\/code><code>\/index<\/code><code>.php?$args;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location ~ \\.php$ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#NOTE: You should have \"cgi.fix_pathinfo = 0;\" in php.ini<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>include fastcgi.conf;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_intercept_errors on;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_pass php;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location ~* \\.(js|css|png|jpg|jpeg|gif|ico)$ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>expires max;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>log_not_found off;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u8fd9\u662f Nginx \u7684\u6700\u65b0\u793a\u4f8b\uff1a<a href=\"https:\/\/www.nginx.com\/resources\/wiki\/start\/topics\/recipes\/wordpress\/\">https :\/\/www.nginx.com\/resources\/wiki\/start\/topics\/recipes\/wordpress\/<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"wordpress-multisite-subdirectory-rules\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#wordpress-multisite-subdirectory-rules\">WordPress \u591a\u7ad9\u70b9\u5b50\u76ee\u5f55\u89c4\u5219<\/a><\/h3>\n\n\n\n<p>\u5bf9\u4e8e\u591a\u7ad9\u70b9\u5b50\u76ee\u5f55\u5b89\u88c5\uff0c\u8fd9\u91cc\u662f\u201cglobal\/wordpress.conf\u201d\u6587\u4ef6\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950<\/td><td><code># WordPress multisite subdirectory rules.<\/code><code># Designed to be included in any server {} block.<\/code>&nbsp;<code>map $uri $blogname{<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>~^(?P\/[^\/]+\/)files\/(.*)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $blogpath ;<\/code><code>}<\/code>&nbsp;<code>map $blogname $blogid{<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>default -999;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#Ref: https:\/\/wordpress.org\/extend\/plugins\/nginx-helper\/<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#include \/var\/www\/wordpress\/wp-content\/plugins\/nginx-helper\/map.conf ;<\/code><code>}<\/code>&nbsp;<code>server {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>server_name example.com ;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>root <\/code><code>\/var\/www\/example<\/code><code>.com<\/code><code>\/htdocs<\/code><code>;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>index index.php;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location ~ ^(\/[^\/]+\/)?files\/(.+) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files <\/code><code>\/wp-content\/blogs<\/code><code>.<\/code><code>dir<\/code><code>\/$blogid<\/code><code>\/files\/<\/code><code>$2 <\/code><code>\/wp-includes\/ms-files<\/code><code>.php?<\/code><code>file<\/code><code>=$2 ;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log off;&nbsp;&nbsp;&nbsp;&nbsp; log_not_found off; expires max;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#avoid php readfile()<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location ^~ <\/code><code>\/blogs<\/code><code>.<\/code><code>dir<\/code> <code>{<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>internal;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>alias<\/code> <code>\/var\/www\/example<\/code><code>.com<\/code><code>\/htdocs\/wp-content\/blogs<\/code><code>.<\/code><code>dir<\/code> <code>;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log off;&nbsp;&nbsp;&nbsp;&nbsp; log_not_found off; expires max;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>if<\/code> <code>(!-e $request_filename) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>rewrite <\/code><code>\/wp-admin<\/code><code>$ $scheme:<\/code><code>\/\/<\/code><code>$host$request_uri\/ permanent;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>rewrite ^(\/[^\/]+)?(<\/code><code>\/wp-<\/code><code>.*) $2 last;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>rewrite ^(\/[^\/]+)?(\/.*\\.php) $2 last;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location \/ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files $uri $uri\/ <\/code><code>\/index<\/code><code>.php?$args ;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location ~ \\.php$ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files $uri =404;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>include fastcgi_params;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_pass php;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#add some rules for static content expiry-headers here<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>NGINX \u63d0\u4f9b\u4e86 2 \u4e2a\u7279\u6b8a\u6307\u4ee4\uff1aX-Accel-Redirect \u548c map\u3002\u4f7f\u7528\u8fd9 2 \u4e2a\u6307\u4ee4\uff0c\u53ef\u4ee5\u6d88\u9664 WordPress \u591a\u7ad9\u70b9\u7f51\u7edc\u4e0a\u9759\u6001\u6587\u4ef6\u670d\u52a1\u7684\u6027\u80fd\u635f\u5931\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"wordpress-multisite-subdomains-rules\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#wordpress-multisite-subdomains-rules\">WordPress \u591a\u7ad9\u70b9\u5b50\u57df\u89c4\u5219<\/a><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>123456789101112131415161718192021222324252627282930313233343536373839<\/td><td><code>map $http_host $blogid {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>default&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -999;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#Ref: https:\/\/wordpress.org\/extend\/plugins\/nginx-helper\/<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#include \/var\/www\/wordpress\/wp-content\/plugins\/nginx-helper\/map.conf ;<\/code>&nbsp;<code>}<\/code>&nbsp;<code>server {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>server_name example.com *.example.com ;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>root <\/code><code>\/var\/www\/example<\/code><code>.com<\/code><code>\/htdocs<\/code><code>;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>index index.php;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location \/ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files $uri $uri\/ <\/code><code>\/index<\/code><code>.php?$args ;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location ~ \\.php$ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files $uri =404;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>include fastcgi_params;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_pass php;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#WPMU Files<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location ~ ^<\/code><code>\/files\/<\/code><code>(.*)$ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files <\/code><code>\/wp-content\/blogs<\/code><code>.<\/code><code>dir<\/code><code>\/$blogid\/$uri <\/code><code>\/wp-includes\/ms-files<\/code><code>.php?<\/code><code>file<\/code><code>=$1 ;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log off; log_not_found off;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; expires max;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#WPMU x-sendfile to avoid php readfile()<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>location ^~ <\/code><code>\/blogs<\/code><code>.<\/code><code>dir<\/code> <code>{<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>internal;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>alias<\/code> <code>\/var\/www\/example<\/code><code>.com<\/code><code>\/htdocs\/wp-content\/blogs<\/code><code>.<\/code><code>dir<\/code><code>;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log off;&nbsp;&nbsp;&nbsp;&nbsp; log_not_found off;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; expires max;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#add some rules for static content expiry-headers here<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u53c2\u8003\uff1a<a href=\"https:\/\/www.nginx.com\/resources\/wiki\/start\/topics\/recipes\/wordpress\/\">https :\/\/www.nginx.com\/resources\/wiki\/start\/topics\/recipes\/wordpress\/<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"https-in-nginx\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#https-in-nginx\">Nginx \u4e2d\u7684 HTTPS<\/a><\/h3>\n\n\n\n<p>\u5728 Nginx \u4e2d\u542f\u7528 HTTPS \u76f8\u5bf9\u7b80\u5355\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>123456789101112131415161718192021222324<\/td><td><code>server {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># listens both on IPv4 and IPv6 on 443 and enables HTTPS and HTTP\/2 support.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># HTTP\/2 is available in nginx 1.9.5 and above.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>listen *:443 ssl http2;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>listen [::]:443 ssl http2;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># indicate locations of SSL key files.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>ssl_certificate <\/code><code>\/srv\/www\/ssl\/ssl<\/code><code>.crt;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>ssl_certificate_key <\/code><code>\/srv\/www\/ssl\/ssl<\/code><code>.key;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>ssl_dhparam <\/code><code>\/srv\/www\/master\/ssl\/dhparam<\/code><code>.pem;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># indicate the server name<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>server_name example.com *.example.com;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># Enable HSTS. This forces SSL on clients that respect it, most modern browsers. The includeSubDomains flag is optional.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>add_header Strict-Transport-Security <\/code><code>\"max-age=31536000; includeSubDomains\"<\/code><code>;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># Set caches, protocols, and accepted ciphers. This config will merit an A+ SSL Labs score as of Sept 2015.<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>ssl_session_cache shared:SSL:20m;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>ssl_session_timeout 10m;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>ssl_protocols TLSv1 TLSv1.1 TLSv1.2;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>ssl_prefer_server_ciphers on;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>ssl_ciphers <\/code><code>'ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5'<\/code><code>;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Mozilla \u8fd8\u63d0\u4f9b\u4e86<a href=\"https:\/\/mozilla.github.io\/server-side-tls\/ssl-config-generator\/\">\u51fa\u8272\u7684 SSL \u914d\u7f6e\u751f\u6210\u5de5\u5177<\/a>\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"wp-super-cache-rules\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#wp-super-cache-rules\">WP \u8d85\u7ea7\u7f13\u5b58\u89c4\u5219<\/a><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234567891011121314151617181920212223242526272829303132333435363738394041424344454647<\/td><td><code># WP Super Cache rules.<\/code><code># Designed to be included from a 'wordpress-ms-...' configuration file.<\/code>&nbsp;<code>set<\/code> <code>$cache_uri $request_uri;<\/code>&nbsp;<code># POST requests and urls with a query string should always go to PHP<\/code><code>if<\/code> <code>($request_method = POST) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set<\/code> <code>$cache_uri <\/code><code>'null cache'<\/code><code>;<\/code><code>}<\/code>&nbsp;<code>if<\/code> <code>($query_string != <\/code><code>\"\"<\/code><code>) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set<\/code> <code>$cache_uri <\/code><code>'null cache'<\/code><code>;<\/code><code>}&nbsp;&nbsp; <\/code>&nbsp;<code># Don't cache uris containing the following segments<\/code><code>if<\/code> <code>($request_uri ~* <\/code><code>\"(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail).php|wp-.*.php|\/feed\/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)\"<\/code><code>) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set<\/code> <code>$cache_uri <\/code><code>'null cache'<\/code><code>;<\/code><code>}&nbsp;&nbsp; <\/code>&nbsp;<code># Don't use the cache for logged in users or recent commenters<\/code><code>if<\/code> <code>($http_cookie ~* <\/code><code>\"comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in\"<\/code><code>) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set<\/code> <code>$cache_uri <\/code><code>'null cache'<\/code><code>;<\/code><code>}<\/code>&nbsp;<code># START MOBILE<\/code><code># Mobile browsers section to server them non-cached version. COMMENTED by default as most modern wordpress themes including twenty-eleven are responsive. Uncomment config lines in this section if you want to use a plugin like WP-Touch<\/code><code># if ($http_x_wap_profile) {<\/code><code>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set $cache_uri 'null cache';<\/code><code>#}<\/code>&nbsp;<code>#if ($http_profile) {<\/code><code>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set $cache_uri 'null cache';<\/code><code>#}<\/code>&nbsp;<code>#if ($http_user_agent ~* (2.0\\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine\/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA\/WX310K|LG\/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\\ Wii|Nitro|Nokia|Opera\\ Mini|Palm|PlayStation\\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\\ CE|WinWAP|YahooSeeker\/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\\ Obigo|LGE\\ VX|webOS|Nokia5800)) {<\/code><code>&nbsp;<\/code><code>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set $cache_uri 'null cache';<\/code><code>#}<\/code>&nbsp;<code>#if ($http_user_agent ~* (w3c\\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg\/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\\ |xda-)) {<\/code><code>&nbsp;&nbsp;<\/code><code>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set $cache_uri 'null cache';<\/code><code>#}<\/code><code>#END MOBILE<\/code>&nbsp;<code># Use cached or actual file if they exists, otherwise pass request to WordPress<\/code><code>location \/ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files <\/code><code>\/wp-content\/cache\/supercache\/<\/code><code>$http_host\/$cache_uri<\/code><code>\/index<\/code><code>.html $uri $uri\/ <\/code><code>\/index<\/code><code>.php?$args ;<\/code><code>}&nbsp;&nbsp;&nbsp;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u5b9e\u9a8c\u4fee\u6539\uff1a<\/strong><\/p>\n\n\n\n<p>\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f HTTPS\uff0cWP Super Cache \u7684\u6700\u65b0\u5f00\u53d1\u7248\u672c\u53ef\u80fd\u4f1a\u4f7f\u7528\u4e0d\u540c\u7684\u76ee\u5f55\u7ed3\u6784\u6765\u533a\u5206 HTTP \u548c HTTPS\u3002try_files \u884c\u53ef\u80fd\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>123<\/td><td><code>location \/ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files \/wp-content\/cache\/supercache\/$http_host\/$cache_uri\/index-https.html $uri $uri\/ \/index.php?$args ;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"w3-total-cache-rules\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#w3-total-cache-rules\">W3 \u603b\u7f13\u5b58\u89c4\u5219<\/a><\/h3>\n\n\n\n<p>W3 Total Cache \u6839\u636e WordPress \u914d\u7f6e\u4f7f\u7528\u4e0d\u540c\u7684\u76ee\u5f55\u7ed3\u6784\u8fdb\u884c\u57fa\u4e8e\u78c1\u76d8\u7684\u7f13\u5b58\u5b58\u50a8\u3002<\/p>\n\n\n\n<p>\u7f13\u5b58\u9a8c\u8bc1\u68c0\u67e5\u5c06\u4fdd\u6301\u5e38\u89c1\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234567891011121314151617181920212223<\/td><td><code>#W3 TOTAL CACHE CHECK <\/code><code>set $cache_uri $request_uri;<\/code>&nbsp;<code># POST requests and urls with a query string should always go to PHP<\/code><code>if ($request_method = POST) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $cache_uri 'null cache';<\/code><code>}&nbsp;&nbsp; <\/code><code>if ($query_string != \"\") {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $cache_uri 'null cache';<\/code><code>}&nbsp;&nbsp; <\/code>&nbsp;<code># Don't cache uris containing the following segments<\/code><code>if ($request_uri ~* \"(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail).php|wp-.*.php|\/feed\/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)\") {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $cache_uri 'null cache';<\/code><code>}&nbsp;&nbsp; <\/code>&nbsp;<code># Don't use the cache for logged in users or recent commenters<\/code><code>if ($http_cookie ~* \"comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in\") {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $cache_uri 'null cache';<\/code><code>}<\/code><code>#ADD mobile rules from WP SUPER CACHE section above<\/code>&nbsp;<code>#APPEND A CODE BLOCK FROM BELOW...<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u5bf9\u4e8e\u666e\u901a WordPress\uff08\u6ca1\u6709\u591a\u7ad9\u70b9\uff09<\/strong><br>\u4f7f\u7528\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234<\/td><td><code># Use cached or actual file if they exists, otherwise pass request to WordPress<\/code><code>location \/ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files \/wp-content\/w3tc\/pgcache\/$cache_uri\/_index.html $uri $uri\/ \/index.php?$args ;<\/code><code>}&nbsp;&nbsp;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>FOR \u5e26\u6709\u5b50\u76ee\u5f55<\/strong><br>\u7684\u591a\u7ad9\u70b9\u4f7f\u7528\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234567891011121314<\/td><td><code>if ( $request_uri ~* \"^\/([_0-9a-zA-Z-]+)\/.*\" ){<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $blog $1;<\/code><code>}<\/code>&nbsp;<code>set $blog \"${blog}.\";<\/code>&nbsp;<code>if ( $blog = \"blog.\" ){<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $blog \"\";<\/code><code>}<\/code>&nbsp;<code># Use cached or actual file if they exists, otherwise pass request to WordPress<\/code><code>location \/ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files \/wp-content\/w3tc-$blog$host\/pgcache$cache_uri\/_index.html $uri $uri\/ \/index.php?$args ;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>FOR \u5177\u6709\u5b50\u57df\/\u57df\u6620\u5c04\u7684\u591a\u7ad9\u70b9<\/strong><br>\u4f7f\u7528\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>123<\/td><td><code>location \/ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files \/wp-content\/w3tc-$host\/pgcache\/$cache_uri\/_index.html $uri $uri\/ \/index.php?$args;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u7b14\u8bb0<\/strong><\/p>\n\n\n\n<ul><li>Nginx \u53ef\u4ee5\u81ea\u52a8\u5904\u7406 gzip \u548c\u6d4f\u89c8\u5668\u7f13\u5b58\uff0c\u6240\u4ee5\u6700\u597d\u628a\u8fd9\u90e8\u5206\u7559\u7ed9 nginx\u3002<\/li><li>W3 Total Cache Minify \u89c4\u5219\u9002\u7528\u4e8e\u4e0a\u8ff0\u914d\u7f6e\uff0c\u6ca1\u6709\u4efb\u4f55\u95ee\u9898\u3002<\/li><\/ul>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"nginx-fastcgi_cache\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#nginx-fastcgi_cache\">Nginx fastcgi_cache<\/a><\/h2>\n\n\n\n<p>Nginx \u53ef\u4ee5\u81ea\u884c\u6267\u884c\u7f13\u5b58\u4ee5\u51cf\u5c11\u670d\u52a1\u5668\u4e0a\u7684\u8d1f\u8f7d\u3002\u5f53\u4f60\u60f3\u4f7f\u7528 Nginx \u5185\u7f6e\u7684 fastcgi_cache \u65f6\uff0c\u6700\u597d\u7528<a href=\"https:\/\/github.com\/FRiCKLE\/ngx_cache_purge\">fastcgi_cache_purge<\/a>\u6a21\u5757\u7f16\u8bd1 nginx\u3002\u5b83\u5c06\u5e2e\u52a9 nginx \u5728\u9875\u9762\u88ab\u7f16\u8f91\u65f6\u6e05\u9664\u7f13\u5b58\u3002\u5728 WordPress \u65b9\u9762\uff0c\u60a8\u9700\u8981\u5b89\u88c5\u4e00\u4e2a\u50cf<a href=\"https:\/\/wordpress.org\/plugins\/nginx-helper\/\">Nginx Helper<\/a>\u8fd9\u6837\u7684\u63d2\u4ef6\u6765\u4f7f\u7528 fastcgi_cache_purge \u529f\u80fd\u3002<\/p>\n\n\n\n<p>\u914d\u7f6e\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<p><strong>\u5728 http{&#8230;} \u5757\u4e2d\u5b9a\u4e49\u4e00\u4e2a Nginx \u7f13\u5b58\u533a\uff0c\u5728 server{&#8230;} \u5757\u4e4b\u5916<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234<\/td><td><code>#move next 3 lines to \/etc\/nginx\/nginx.conf if you want to use fastcgi_cache across many sites <\/code><code>fastcgi_cache_path \/var\/run\/nginx-cache levels=1:2 keys_zone=WORDPRESS:500m inactive=60m;<\/code><code>fastcgi_cache_key \"$scheme$request_method$host$request_uri\";<\/code><code>fastcgi_cache_use_stale error timeout invalid_header http_500;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u5bf9\u4e8e WordPress \u7ad9\u70b9\u914d\u7f6e\uff0c\u5728 server{..} \u5757\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u7f13\u5b58\u68c0\u67e5\u5757\uff0c\u5982\u4e0b\u6240\u793a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234567891011121314151617181920<\/td><td><code>#fastcgi_cache start<\/code><code>set $no_cache 0;<\/code>&nbsp;<code># POST requests and urls with a query string should always go to PHP<\/code><code>if ($request_method = POST) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $no_cache 1;<\/code><code>}&nbsp;&nbsp; <\/code><code>if ($query_string != \"\") {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $no_cache 1;<\/code><code>}&nbsp;&nbsp; <\/code>&nbsp;<code># Don't cache uris containing the following segments<\/code><code>if ($request_uri ~* \"(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail).php|wp-.*.php|\/feed\/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)\") {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $no_cache 1;<\/code><code>}&nbsp;&nbsp; <\/code>&nbsp;<code># Don't use the cache for logged in users or recent commenters<\/code><code>if ($http_cookie ~* \"comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in\") {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>set $no_cache 1;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u7136\u540e\u66f4\u6539 PHP \u5904\u7406\u5757<\/strong><\/p>\n\n\n\n<p>\u53ea\u9700\u5c06\u5176\u6dfb\u52a0\u5230\u4ee5\u4e0b php \u5757\u3002\u6ce8\u610f<code>fastcgi_cache_valid 200 60m;<\/code>\u544a\u8bc9 nginx \u53ea\u7f13\u5b58 200 \u4e2a\u54cd\u5e94\uff08\u666e\u901a\u9875\u9762\uff09\u7684\u884c\uff0c\u8fd9\u610f\u5473\u7740\u4e0d\u7f13\u5b58\u91cd\u5b9a\u5411\u3002\u8fd9\u5bf9\u4e8e\u591a\u8bed\u8a00\u7ad9\u70b9\u5f88\u91cd\u8981\uff0c\u5982\u679c\u6ca1\u6709\u5b9e\u73b0\uff0cnginx \u4f1a\u4ee5\u4e00\u79cd\u8bed\u8a00\u7f13\u5b58\u4e3b url\uff0c\u800c\u4e0d\u662f\u6839\u636e\u7528\u6237\u7684\u8bed\u8a00\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u5404\u81ea\u7684\u5185\u5bb9\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12345<\/td><td><code>fastcgi_cache_bypass $no_cache;<\/code><code>fastcgi_no_cache $no_cache;<\/code>&nbsp;<code>fastcgi_cache WORDPRESS;<\/code><code>fastcgi_cache_valid 200 60m;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u8fd9\u6837\u5b83\u5c31\u53d8\u6210\u4e86\u8fd9\u6837<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>123456789101112131415161718<\/td><td><code>location ~ [^\/]\\.php(\/|$) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_split_path_info ^(.+?\\.php)(\/.*)$;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>if (!-f $document_root$fastcgi_script_name) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>return 404;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>}<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># This is a robust solution for path info security issue and works with \"cgi.fix_pathinfo = 1\" in \/etc\/php.ini (default)<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>include fastcgi.conf;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_index index.php;<\/code><code>#&nbsp;&nbsp;&nbsp; fastcgi_intercept_errors on;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_pass php;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_cache_bypass $no_cache;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_no_cache $no_cache;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_cache WORDPRESS;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_cache_valid 200 60m;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u6700\u540e\u6dfb\u52a0\u4e00\u4e2a\u6709\u6761\u4ef6\u6e05\u9664\u7684\u4f4d\u7f6e<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234567<\/td><td><code>location ~ \/purge(\/.*) {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code># Uncomment the following two lines to allow purge only from the webserver<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#allow 127.0.0.1;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>#deny all;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>fastcgi_cache_purge WORDPRESS \"$scheme$request_method$host$1\";<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u5982\u679c\u60a8\u6536\u5230\u201c\u672a\u77e5\u6307\u4ee4\u201cfastcgi_cache_purge\u201d\u9519\u8bef\uff0c\u8bf7\u68c0\u67e5\u60a8\u7684 Nginx \u5b89\u88c5\u662f\u5426\u5177\u6709 fastcgi_cache_purge \u6a21\u5757\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"better-performance-for-static-files-in-multisite\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#better-performance-for-static-files-in-multisite\">\u591a\u7ad9\u70b9\u4e2d\u9759\u6001\u6587\u4ef6\u7684\u66f4\u597d\u6027\u80fd<\/a><\/h2>\n\n\n\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5728\u591a\u7ad9\u70b9\u8bbe\u7f6e\u4e2d\uff0c\u9759\u6001\u6587\u4ef6\u8bf7\u6c42\u4f1a\u5c06 php \u5e26\u5165\u56fe\u7247 ie<code>ms-files.php<\/code>\u6587\u4ef6\u3002<code>Map{..}<\/code>\u4f7f\u7528 Nginx\u6307\u4ee4\u53ef\u4ee5\u83b7\u5f97\u66f4\u597d\u7684\u6027\u80fd\u3002<\/p>\n\n\n\n<p>\u5728\u60a8\u7ad9\u70b9\u7684 Nginx \u914d\u7f6e\u4e2d\uff0c\u5728\u4e0a\u9762\u7684<code>server{..}<\/code>\u5757\u4e2d\uff0c\u6dfb\u52a0\u5982\u4e0b\u90e8\u5206\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234567<\/td><td><code>map $http_host $blogid {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>default&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>example.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>site1.example.com&nbsp;&nbsp;&nbsp;&nbsp; 2;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>site1.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u5b83\u53ea\u662f\u7ad9\u70b9\u540d\u79f0\u548c\u535a\u5ba2 ID \u7684\u5217\u8868\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528<a href=\"https:\/\/wordpress.org\/extend\/plugins\/nginx-helper\">Nginx \u52a9\u624b<\/a>\u6765\u83b7\u53d6\u8fd9\u6837\u7684\u7ad9\u70b9\u540d\u79f0\/\u535a\u5ba2 ID \u5bf9\u5217\u8868\u3002\u8be5\u63d2\u4ef6\u8fd8\u5c06\u751f\u6210\u4e00\u4e2a<code>map.conf<\/code>\u6587\u4ef6\uff0c\u60a8\u53ef\u4ee5\u5c06\u5176\u76f4\u63a5\u5305\u542b\u5728 map{} \u90e8\u5206\u4e2d\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12345<\/td><td><code>map $http_host $blogid {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>default&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0;<\/code>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>include <\/code><code>\/path\/to\/map<\/code><code>.conf ;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u521b\u5efa<code>map{..}<\/code>\u90e8\u5206\u540e\uff0c\u60a8\u53ea\u9700\u5728 Nginx \u914d\u7f6e\u4e2d\u518d\u8fdb\u884c\u4e00\u6b21\u66f4\u6539\uff0c\u4ee5\u4fbf<code>\/files\/<\/code>\u9996\u5148\u4f7f\u7528 nginx \u5904\u7406\u8bf7\u6c42<code>map{..}<\/code>\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234<\/td><td><code>location ~ ^\/files\/(.*)$ {<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>try_files \/wp-content\/blogs.dir\/$blogid\/$uri \/wp-includes\/ms-files.php?file=$1 ;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>access_log off; log_not_found off; expires max;<\/code><code>&nbsp;<\/code><code>}<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"notes\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#notes\">\u7b14\u8bb0<\/a><\/h3>\n\n\n\n<ul><li>\u6bcf\u5f53\u521b\u5efa\u3001\u5220\u9664\u65b0\u7ad9\u70b9\u6216\u5c06\u989d\u5916\u57df\u6620\u5c04\u5230\u73b0\u6709\u7ad9\u70b9\u65f6\uff0cNginx \u52a9\u624b\u5c06\u81ea\u52a8\u66f4\u65b0 map.conf \u6587\u4ef6\uff0c\u4f46\u60a8\u4ecd\u9700\u8981\u624b\u52a8\u91cd\u65b0\u52a0\u8f7d Nginx \u914d\u7f6e\u3002\u4f60\u53ef\u4ee5\u5728\u4ee5\u540e\u7684\u4efb\u4f55\u65f6\u5019\u8fd9\u6837\u505a\u3002\u5230\u90a3\u65f6\uff0c\u53ea\u6709\u65b0\u7ad9\u70b9\u7684\u6587\u4ef6\u5c06\u4f7f\u7528 php-fpm \u63d0\u4f9b\u3002<\/li><li>\u6b64\u65b9\u6cd5\u4e0d\u751f\u6210\u4efb\u4f55\u7b26\u53f7\u94fe\u63a5\u3002\u56e0\u6b64\uff0c\u610f\u5916\u5220\u9664\u6216\u9075\u5faa\u7b26\u53f7\u94fe\u63a5\u7684\u5907\u4efd\u811a\u672c\u4e0d\u4f1a\u6709\u4efb\u4f55\u95ee\u9898\u3002<\/li><li>\u5bf9\u4e8e\u5927\u578b\u7f51\u7edc\uff0c\u8fd9\u5c06\u5f88\u597d\u5730\u6269\u5c55\uff0c\u56e0\u4e3a\u4f1a\u6709\u4e00\u4e2a map.conf \u6587\u4ef6\u3002<\/li><\/ul>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"notes-2\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#notes-2\">\u7b14\u8bb0<\/a><\/h2>\n\n\n\n<p>\u4e00\u4e9b\u6700\u540e\u4f46\u91cd\u8981\u7684\u6ce8\u610f\u4e8b\u9879\uff1a\u6574\u4e2a\u8bbe\u7f6e\u5047\u8bbe\u7ad9\u70b9\u7684\u6839\u662f\u535a\u5ba2\uff0c\u5e76\u4e14\u5c06\u5f15\u7528\u7684\u6240\u6709\u6587\u4ef6\u90fd\u9a7b\u7559\u5728\u4e3b\u673a\u4e0a\u3002\u5982\u679c\u60a8\u5c06\u535a\u5ba2\u653e\u5728 \/blog \u7b49\u5b50\u76ee\u5f55\u4e2d\uff0c\u5219\u5fc5\u987b\u4fee\u6539\u89c4\u5219\u3002\u4e5f\u8bb8\u6709\u4eba\u53ef\u4ee5\u91c7\u7528\u8fd9\u4e9b\u89c4\u5219\u5e76\u4f7f\u4e4b\u6210\u4e3a\u53ef\u80fd\uff0c\u4f8b\u5982\uff0c\u4f7f\u7528\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>set $wp_subdir \"\/blog\";<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u4e3b\u201c\u670d\u52a1\u5668\u201d\u5757\u4e2d\u7684\u6307\u4ee4\uff0c\u5e76\u4f7f\u5176\u81ea\u52a8\u5e94\u7528\u4e8e\u901a\u7528 WP \u89c4\u5219\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"warning\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#warning\">\u8b66\u544a<\/a><\/h2>\n\n\n\n<ul><li><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#global-restrictions-file\">\u5168\u5c40\u9650\u5236\u6587\u4ef6<\/a>\u4e2d\u7684\u62fc\u5199\u9519\u8bef\u4f1a\u9020\u6210\u6f0f\u6d1e\u3002\u8981\u6d4b\u8bd5\u60a8\u7684\u201c\u4e0a\u4f20\u201d\u76ee\u5f55\u662f\u5426\u771f\u7684\u53d7\u5230\u4fdd\u62a4\uff0c\u8bf7\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u4e00\u4e9b\u5185\u5bb9\u7684 PHP \u6587\u4ef6\uff08\u4f8b\u5982\uff1a&lt;?php phpinfo(); ?&gt;\uff09\uff0c\u5c06\u5176\u4e0a\u4f20\u5230\u201c\u4e0a\u4f20\u201d\u76ee\u5f55\uff08\u6216\u5176\u5b50\u76ee\u5f55\u4e4b\u4e00\uff09\uff0c\u7136\u540e\u5c1d\u8bd5\u4ece\u60a8\u7684\u6d4f\u89c8\u5668\u8bbf\u95ee\uff08\u6267\u884c\uff09\u5b83\u3002<\/li><\/ul>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"resources\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#resources\">\u8d44\u6e90<\/a><\/h2>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"reference\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#reference\">\u53c2\u8003<\/a><\/h3>\n\n\n\n<ul><li><a href=\"https:\/\/wordpress.org\/support\/topic\/nginx-php-fpm-php-apc-wordpress-multisite-subdirectory-wp-super-cache\">nginx + php-fpm + PHP APC + WordPress \u591a\u7ad9\u70b9\uff08\u5b50\u76ee\u5f55\uff09+ WP \u8d85\u7ea7\u7f13\u5b58<\/a>\uff08\u611f\u8c22<a href=\"https:\/\/wordpress.org\/support\/profile\/bigsite\">bigsite<\/a>\uff09<\/li><li><a href=\"http:\/\/josephscott.org\/archives\/2010\/06\/wordpress-pretty-permalinks-with-nginx\/\">\u4ece\u6c38\u4e45\u94fe\u63a5\u4e2d\u5220\u9664 &#8216;index.php&#8217; \u7684\u6ce8\u610f\u4e8b\u9879<\/a>\uff08\u53ef\u4ee5\u4f7f\u7528<a href=\"https:\/\/wordpress.org\/extend\/plugins\/nginx-helper\/\">Nginx Helper Plugin<\/a>\u5b8c\u6210\uff09<\/li><\/ul>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"external-links\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#external-links\">\u5916\u90e8\u94fe\u63a5<\/a><\/h3>\n\n\n\n<ul><li><a href=\"http:\/\/wiki.nginx.org\/WordPress\">Nginx WordPress \u7ef4\u57fa\u9875\u9762<\/a><\/li><li><a href=\"http:\/\/wiki.nginx.org\/FullExample\">Nginx \u5b8c\u6574\u793a\u4f8b<\/a><\/li><li><a href=\"http:\/\/wiki.nginx.org\/FullExample2\">Nginx \u5b8c\u6574\u793a\u4f8b 2<\/a><\/li><li><a href=\"http:\/\/library.linode.com\/lemp-guides\/\">Linode \u56fe\u4e66\u9986\u7684 LEMP \u6307\u5357<\/a><\/li><li><a href=\"http:\/\/library.linode.com\/web-servers\/nginx\/\">Linode \u5e93\u4e0a\u6709\u5173 Nginx \u7684\u5404\u79cd\u6307\u5357<\/a><\/li><li><a href=\"http:\/\/www.sitepoint.com\/lightning-fast-wordpress-with-php-fpm-and-nginx\/\">\u4f7f\u7528 Php-fpm \u548c Nginx \u7684\u95ea\u7535\u822c\u5feb\u901f\u7684 WordPress<\/a><\/li><li><a href=\"http:\/\/wiki.nginx.org\/VirtualHostExample\">\u865a\u62df\u4e3b\u673a\u793a\u4f8b<\/a><\/li><li><a href=\"http:\/\/rtcamp.com\/wordpress-nginx\/tutorials\/\">\u9488\u5bf9\u5e38\u89c1\u60c5\u51b5\u7684 20 \u591a\u4e2a WordPress-Nginx \u6559\u7a0b\u5217\u8868<\/a><\/li><li><a href=\"http:\/\/blog.martinfjordvald.com\/2010\/07\/nginx-primer\/\">Nginx\u914d\u7f6e\u4ecb\u7ecd<\/a><\/li><li><a href=\"https:\/\/deliciousbrains.com\/hosting-wordpress-setup-secure-virtual-server\/\">\u5173\u4e8e\u4f7f\u7528 Nginx \u81ea\u5df1\u6258\u7ba1 WordPress \u7684\u7efc\u5408\u535a\u5ba2\u7cfb\u5217<\/a><\/li><li><a href=\"http:\/\/centminmod.com\/nginx_configure_wordpress.html\">WordPress \u5b89\u88c5 CentminMod<\/a><\/li><li><a href=\"https:\/\/thecustomizewindows.com\/2015\/12\/nginx-wordpress-installation-guide-steps\/\">Nginx WordPress \u5b89\u88c5\u6307\u5357<\/a><\/li><\/ul>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"scripts-tools\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#scripts-tools\">\u811a\u672c\u548c\u5de5\u5177<\/a><\/h3>\n\n\n\n<ul><li>\u5bf9\u4e8e WordPress Nginx \u811a\u672c\u5b89\u88c5<a href=\"http:\/\/centminmod.com\/nginx_configure_wordpress.html\">CentminMod<\/a>\u53ef\u7528\u4e8e CentOS\u3002<\/li><\/ul>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#top\">\u9876\u90e8\u2191<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"securing-nginx\"><a href=\"https:\/\/wordpress.org\/support\/article\/nginx\/#securing-nginx\">\u4fdd\u62a4 Nginx<\/a><\/h3>\n\n\n\n<ul><li><a href=\"http:\/\/kbeezie.com\/view\/securing-nginx-php\/\">\u4fdd\u62a4 Nginx \u548c PHP<\/a><\/li><li><a href=\"https:\/\/nealpoole.com\/blog\/2011\/04\/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration\/\">\u8bbe\u7f6e PHP-FastCGI \u548c nginx\uff1f\u4e0d\u8981\u76f8\u4fe1\u6559\u7a0b\uff1a\u68c0\u67e5\u4f60\u7684\u914d\u7f6e\uff01<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u867d\u7136 LAMP \u5806\u6808\uff08Linux + Apache + MySQL + PHP\uff09\u5728\u652f\u6301 WordPress \u65b9 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/wpeyes.com\/wordpress\/docs\/nginx\"> <span class=\"screen-reader-text\">Nginx<\/span> Read More \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"doc_category":[3],"doc_tag":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Nginx - WordPress\u4e2d\u6587<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpeyes.com\/wordpress\/docs\/nginx\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Nginx - WordPress\u4e2d\u6587\" \/>\n<meta property=\"og:description\" content=\"\u867d\u7136 LAMP \u5806\u6808\uff08Linux + Apache + MySQL + PHP\uff09\u5728\u652f\u6301 WordPress \u65b9 &hellip; Nginx Read More \u00bb\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpeyes.com\/wordpress\/docs\/nginx\" \/>\n<meta property=\"og:site_name\" content=\"WordPress\u4e2d\u6587\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-01T09:27:00+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data1\" content=\"10\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpeyes.com\/wordpress\/docs\/nginx\",\"url\":\"https:\/\/wpeyes.com\/wordpress\/docs\/nginx\",\"name\":\"Nginx - WordPress\u4e2d\u6587\",\"isPartOf\":{\"@id\":\"https:\/\/wpeyes.com\/wordpress\/#website\"},\"datePublished\":\"2022-07-01T09:26:52+00:00\",\"dateModified\":\"2022-07-01T09:27:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/wpeyes.com\/wordpress\/docs\/nginx#breadcrumb\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpeyes.com\/wordpress\/docs\/nginx\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpeyes.com\/wordpress\/docs\/nginx#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/wpeyes.com\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Docs\",\"item\":\"https:\/\/wpeyes.com\/wordpress\/docs\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Nginx\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpeyes.com\/wordpress\/#website\",\"url\":\"https:\/\/wpeyes.com\/wordpress\/\",\"name\":\"WordPress\u4e2d\u6587\",\"description\":\"wpeyes\u6280\u672f\u89c6\u70b9\",\"publisher\":{\"@id\":\"https:\/\/wpeyes.com\/wordpress\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpeyes.com\/wordpress\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/wpeyes.com\/wordpress\/#organization\",\"name\":\"WordPress\u4e2d\u6587\",\"url\":\"https:\/\/wpeyes.com\/wordpress\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-CN\",\"@id\":\"https:\/\/wpeyes.com\/wordpress\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/wpeyes.com\/wordpress\/wp-content\/uploads\/sites\/8\/2024\/01\/WordPress-logotype-wmark-white.png\",\"contentUrl\":\"https:\/\/wpeyes.com\/wordpress\/wp-content\/uploads\/sites\/8\/2024\/01\/WordPress-logotype-wmark-white.png\",\"width\":1000,\"height\":1000,\"caption\":\"WordPress\u4e2d\u6587\"},\"image\":{\"@id\":\"https:\/\/wpeyes.com\/wordpress\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Nginx - WordPress\u4e2d\u6587","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wpeyes.com\/wordpress\/docs\/nginx","og_locale":"zh_CN","og_type":"article","og_title":"Nginx - WordPress\u4e2d\u6587","og_description":"\u867d\u7136 LAMP \u5806\u6808\uff08Linux + Apache + MySQL + PHP\uff09\u5728\u652f\u6301 WordPress \u65b9 &hellip; Nginx Read More \u00bb","og_url":"https:\/\/wpeyes.com\/wordpress\/docs\/nginx","og_site_name":"WordPress\u4e2d\u6587","article_modified_time":"2022-07-01T09:27:00+00:00","twitter_card":"summary_large_image","twitter_misc":{"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpeyes.com\/wordpress\/docs\/nginx","url":"https:\/\/wpeyes.com\/wordpress\/docs\/nginx","name":"Nginx - WordPress\u4e2d\u6587","isPartOf":{"@id":"https:\/\/wpeyes.com\/wordpress\/#website"},"datePublished":"2022-07-01T09:26:52+00:00","dateModified":"2022-07-01T09:27:00+00:00","breadcrumb":{"@id":"https:\/\/wpeyes.com\/wordpress\/docs\/nginx#breadcrumb"},"inLanguage":"zh-CN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpeyes.com\/wordpress\/docs\/nginx"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wpeyes.com\/wordpress\/docs\/nginx#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/wpeyes.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Docs","item":"https:\/\/wpeyes.com\/wordpress\/docs"},{"@type":"ListItem","position":3,"name":"Nginx"}]},{"@type":"WebSite","@id":"https:\/\/wpeyes.com\/wordpress\/#website","url":"https:\/\/wpeyes.com\/wordpress\/","name":"WordPress\u4e2d\u6587","description":"wpeyes\u6280\u672f\u89c6\u70b9","publisher":{"@id":"https:\/\/wpeyes.com\/wordpress\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpeyes.com\/wordpress\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-CN"},{"@type":"Organization","@id":"https:\/\/wpeyes.com\/wordpress\/#organization","name":"WordPress\u4e2d\u6587","url":"https:\/\/wpeyes.com\/wordpress\/","logo":{"@type":"ImageObject","inLanguage":"zh-CN","@id":"https:\/\/wpeyes.com\/wordpress\/#\/schema\/logo\/image\/","url":"https:\/\/wpeyes.com\/wordpress\/wp-content\/uploads\/sites\/8\/2024\/01\/WordPress-logotype-wmark-white.png","contentUrl":"https:\/\/wpeyes.com\/wordpress\/wp-content\/uploads\/sites\/8\/2024\/01\/WordPress-logotype-wmark-white.png","width":1000,"height":1000,"caption":"WordPress\u4e2d\u6587"},"image":{"@id":"https:\/\/wpeyes.com\/wordpress\/#\/schema\/logo\/image\/"}}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"qmk","author_link":"https:\/\/wpeyes.com\/wordpress\/archives\/author\/qmk"},"uagb_comment_info":8,"uagb_excerpt":"\u867d\u7136 LAMP \u5806\u6808\uff08Linux + Apache + MySQL + PHP\uff09\u5728\u652f\u6301 WordPress \u65b9&hellip;","_links":{"self":[{"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/docs\/146"}],"collection":[{"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/comments?post=146"}],"version-history":[{"count":1,"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/docs\/146\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/docs\/146\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/media?parent=146"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/doc_category?post=146"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/wpeyes.com\/wordpress\/wp-json\/wp\/v2\/doc_tag?post=146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}