{"id":197878,"date":"2020-11-05T05:48:41","date_gmt":"2020-11-04T21:48:41","guid":{"rendered":"http:\/\/4563.org\/?p=197878"},"modified":"2020-11-05T05:48:41","modified_gmt":"2020-11-04T21:48:41","slug":"nginx-%e7%9a%84%e9%87%8d%e5%ae%9a%e5%90%91%e9%97%ae%e9%a2%98%ef%bc%88%e5%b0%8f%e7%99%bd%e6%8f%90%e9%97%ae%ef%bc%89","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=197878","title":{"rendered":"nginx \u7684\u91cd\u5b9a\u5411\u95ee\u9898\uff08\u5c0f\u767d\u63d0\u95ee\uff09"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  nginx \u7684\u91cd\u5b9a\u5411\u95ee\u9898\uff08\u5c0f\u767d\u63d0\u95ee\uff09               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kuanos <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6211\u81ea\u5df1\u5f04\u4e86\u4e2a wordpress\uff0c\u7528 nginx \u914d\u7f6e\u4e24\u4e2a\u4e0d\u540c\u7684\u76ee\u5f55\u5206\u522b\u4f5c\u4e3a\u4e0d\u540c\u7684\u7ad9\u70b9\uff0c\u5176\u4e2d\u4e00\u4e2a\u6b63\u5e38\u8bbf\u95ee\uff0c\u53e6\u4e00\u4e2a\u914d\u7f6e\u597d\u4e86\u4e4b\u540e\uff0cssl \u4e5f\u751f\u6548\u4e86\uff0c\u4f46\u662f\u5c31\u662f\u4f1a\u663e\u793a\u91cd\u5b9a\u5411\u6b21\u6570\u8fc7\u591a\uff0c\u6211\u6000\u7591\u662f\u5f3a\u5236 80 \u8f6c 443 \u7684\u95ee\u9898\uff0c\u4f46\u662f nginx-t\uff0c\u4ee5\u53ca status \u90fd\u6ca1\u6709\u62a5\u9519\u3002<\/p>\n<p>\u5c0f\u767d\u627e\u4e0d\u5230\u95ee\u9898\uff0c\u6c42\u89e3\u7b54\uff0c\u975e\u5e38\u611f\u8c22\uff1a<\/p>\n<p>server {<\/p>\n<p> listen 443 ssl;<br \/> listen 80;<\/p>\n<p> server_name ABC.com www.ABC.com;<br \/> client_max_body_size 500m;<\/p>\n<p> root \/var\/www\/wordpress\/;<br \/> index index.php index.html index.htm index.nginx-debian.html;<\/p>\n<p> #if ($scheme = http ) {return 301 https:\/\/$host$request_uri;}<\/p>\n<p> ssl_certificate \/etc\/letsencrypt\/live\/ABC.com\/fullchain.pem;<br \/> ssl_certificate_key \/etc\/letsencrypt\/live\/ABC.com\/privkey.pem;<br \/> ssl_trusted_certificate \/etc\/letsencrypt\/live\/ABC.com\/chain.pem;<br \/> include snippets\/ssl.conf;<br \/> return 301 https:\/\/ABC.com$request_uri;<br \/> include snippets\/letsencrypt.conf;<\/p>\n<p> location \/ {<br \/> # try_files $uri $uri\/ =404;<br \/> try_files $uri $uri\/ \/index.php$is_args$args;<br \/> }<br \/> location ~ .php$ {<br \/> include snippets\/fastcgi-php.conf;<br \/> fastcgi_pass unix:\/run\/php\/php7.2-fpm.sock;<br \/> }<\/p>\n<p> location ~ \/.ht {<br \/> deny all;<br \/> }<br \/> location = \/favicon.ico { log_not_found off; access_log off; }<br \/> location = \/robots.txt { log_not_found off; access_log off; allow all; }<br \/> location ~* .(css|gif|ico|jpeg|jpg|js|png)$ {<br \/> expires max;<br \/> log_not_found off;<br \/> }<br \/> }      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4239291\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jifengg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u8fd9\u4e0d\u7ba1\u4e09\u4e03\u4e8c\u5341\u4e00\u5168\u90e8 return 301\uff0c\u80fd\u4e0d\u91cd\u5b9a\u5411\u6b21\u6570\u8fc7\u591a\u5417\uff1f<br \/>\u6211\u4e00\u4e2a\u670d\u52a1\u5668\u662f\u8fd9\u4e48\u8bbe\u7f6e\u7684\uff1a<\/p>\n<p>#\u8bbe\u7f6e\u57df\u540d\u8df3\u8f6c https<br \/> server{<br \/> listen 80;<br \/> server_name www.example.com;<br \/> return 301 https:\/\/$host$request_uri;<br \/> }<\/p>\n<p>80 \u548c 443 \u7aef\u53e3\u76d1\u542c\u5206\u5f00\uff0c\u7b80\u5355\u6613\u61c2                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4239292\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : WeKeey <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             server {<br \/> listen 80;<br \/> server_name xxx.xyz;<br \/> return 301 https:\/\/xxx.xyz$request_uri;<br \/>}<\/p>\n<p>server {<br \/> listen 443 ssl;<br \/> server_name xxx.xyz;<\/p>\n<p>  ssl_certificate cert\/xyz.xxx.crt;<br \/> ssl_certificate_key cert\/xyz.xxx.key;<br \/> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;<br \/> ssl_ciphers HIGH:!aNULL:!MD5;<\/p>\n<p> location \/ {<br \/> proxy_pass http:\/\/zzz;<br \/> proxy_set_header Host $host;<br \/> proxy_set_header X-Real-IP $remote_addr;<br \/> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/> }<\/p>\n<p> access_log \/var\/log\/nginx\/xxx.access.log;<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4239293\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : kuanos <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @WeKeey @jifengg \u611f\u8c22\uff0c\u5df2\u7ecf\u89e3\u51b3\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4239294\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : quanjw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u8bd5\u8bd5 497 \u72b6\u6001\u7801\uff1f \u4f46\u662f \u6211\u597d\u50cf\u4e0d\u884c \u4e5f\u6ca1\u627e\u5230\u539f\u56e0\u3001\u3001\u3001                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>nginx \u7684\u91cd\u5b9a\u5411\u95ee\u9898\uff08\u5c0f\u767d\u63d0\u95ee&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/197878"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=197878"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/197878\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=197878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=197878"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=197878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}