{"id":150443,"date":"2020-09-03T01:27:49","date_gmt":"2020-09-02T17:27:49","guid":{"rendered":"http:\/\/4563.org\/?p=150443"},"modified":"2020-09-03T01:27:49","modified_gmt":"2020-09-02T17:27:49","slug":"nginx-%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%ae%e5%b0%86%e5%a4%9a%e4%b8%aa%e5%9f%9f%e5%90%8d%e7%9a%84%e6%89%80%e6%9c%89%e8%af%b7%e6%b1%82%e8%b7%b3%e8%bd%ac%e5%88%b0%e5%90%84%e8%87%aa%e9%a6%96%e9%a1%b5","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=150443","title":{"rendered":"nginx \u5982\u4f55\u914d\u7f6e\u5c06\u591a\u4e2a\u57df\u540d\u7684\u6240\u6709\u8bf7\u6c42\u8df3\u8f6c\u5230\u5404\u81ea\u9996\u9875?"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  nginx \u5982\u4f55\u914d\u7f6e\u5c06\u591a\u4e2a\u57df\u540d\u7684\u6240\u6709\u8bf7\u6c42\u8df3\u8f6c\u5230\u5404\u81ea\u9996\u9875?               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jsjcjsjc <\/span>  <span><i><\/i> 21<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u81ea\u5df1\u5c31\u505a\u4e86\u4e00\u4e2a\u9759\u6001\u9875\u9762,\u8bbe\u7f6e\u4e86\u591a\u4e2a\u57df\u540d\u6307\u5411<\/p>\n<p>\u5982\u4f55\u8bbe\u7f6e nginx,\u5c06\u591a\u4e2a\u57df\u540d\u7684\u6240\u6709\u8bf7\u6c42\u8df3\u8f6c\u5230\u5404\u81ea\u9996\u9875?<\/p>\n<p>\u6211\u81ea\u5df1\u6539\u4e86\u5b9d\u5854\u7684\u914d\u7f6e,\u8c8c\u4f3c\u4e0d\u884c\u554a&#8230;\u8bf7\u5404\u4f4d\u5927\u795e\u6307\u70b9\u554a,\u611f\u8c22<\/p>\n<pre><code>server {     listen 80;     server_name ABC.com XYZ.com 123.com www.ABC.com www.XYZ.com www.123.com *.ABC.com *.XYZ.com *.123.com;     rewrite ^\/(.*) http:\/\/$host$1 permanent;      index index.php index.html index.htm default.php default.htm default.html;     root \/www\/wwwroot\/ABC.com;         #REWRITE-START URL \u91cd\u5199\u89c4\u5219\u5f15\u7528,\u4fee\u6539\u540e\u5c06\u5bfc\u81f4\u9762\u677f\u8bbe\u7f6e\u7684\u4f2a\u9759\u6001\u89c4\u5219\u5931\u6548     include \/www\/server\/panel\/vhost\/rewrite\/ABC.com.conf;     #REWRITE-END         #\u7981\u6b62\u8bbf\u95ee\u7684\u6587\u4ef6\u6216\u76ee\u5f55     location ~ ^\/(.user.ini|.htaccess|.git|.svn|.project|LICENSE|README.md)     {         return 404;     }         #\u4e00\u952e\u7533\u8bf7 SSL \u8bc1\u4e66\u9a8c\u8bc1\u76ee\u5f55\u76f8\u5173\u8bbe\u7f6e     location ~ .well-known{         allow all;     }         location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$     {         expires      30d;         error_log off;         access_log \/dev\/null;     }         location ~ .*.(js|css)?$     {         expires      12h;         error_log off;         access_log \/dev\/null;     }     access_log  \/www\/wwwlogs\/ABC.com.log;     error_log  \/www\/wwwlogs\/ABC.com.error.log; } <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>7<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3033559\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lychs1998 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u591a\u5199\u51e0\u4e2a server\uff0clisten 80\uff0c\u8981\u6307\u5411\u540c\u4e2a\u6587\u4ef6\u7684\u653e\u4e00\u4e2a server \u91cc\u3002\u3002\u3002\u53e6\u5916\uff0c\u5b9d\u5854\u4e0d\u662f\u53ef\u4ee5\u76f4\u63a5\u9875\u9762\u914d\u7f6e\u7f51\u7ad9\u7684\u4e48\u3002\u3002\u3002\u6539\u5565\u914d\u7f6e\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3033560\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jsjcjsjc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @lychs1998 \u5b9d\u5854\u53ea\u6709\u4e00\u4e2a\u4e00\u4e2a\u914d\u7f6e,\u6211\u60f3\u5077\u61d2\u5199\u4e00\u8d77\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3033561\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : LokiSharp <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             nginx \u53ef\u4ee5 include \u7684\u590d\u7528\u76f8\u540c\u7684\u914d\u7f6e\u7684\uff0c\u4f60\u53ea\u8981\u6bcf\u4e2a\u6587\u4ef6\u5934\u4e0a server \u5355\u72ec\u5199\uff0c\u4e0b\u9762\u7684\u914d\u7f6e\u662f include \u5c31\u884c\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3033562\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Tink <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5bf9\u554a\uff0c\u4f60\u4e3a\u4ec0\u4e48\u4e0d\u76f4\u63a5 include \u5462                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3033563\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : leopod1995 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             server {<br \/> listen 80;<br \/> server_name: me.com<br \/>}<\/p>\n<p>server {<br \/> listen 80;<br \/> server_name: you.com<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3033564\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jsjcjsjc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @leopod1995 \u611f\u8c22,\u6211\u4e0d\u7ba1\u4e86,\u76f4\u63a5 404 \u8df3\u8f6c\u5230\u9996\u9875\u4e86,\u54c8\u54c8                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3033565\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : guader <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             return 301 https:\/\/$host$request_uri;<br \/>\u4e0d\u77e5\u9053\u662f\u4e0d\u662f\u8bf4\u7684\u8fd9\u4e2a\u610f\u601d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>nginx \u5982\u4f55\u914d\u7f6e\u5c06\u591a\u4e2a\u57df\u540d\u7684\u6240&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\/150443"}],"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=150443"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/150443\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=150443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=150443"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=150443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}