{"id":1580,"date":"2015-03-28T20:01:51","date_gmt":"2015-03-28T12:01:51","guid":{"rendered":"http:\/\/www.51cos.com\/?p=1580"},"modified":"2015-03-28T20:01:51","modified_gmt":"2015-03-28T12:01:51","slug":"%e5%9c%a8lnmp%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a301%e9%87%8d%e5%ae%9a%e5%90%91%e5%9f%9f%e5%90%8d%e6%9c%80%e7%ae%80%e5%8d%95%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/www.51cos.com\/?p=1580","title":{"rendered":"\u5728LNMP\u670d\u52a1\u5668\u4e0a301\u91cd\u5b9a\u5411\u57df\u540d\u6700\u7b80\u5355\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u5047\u8bbe\u4f60\u7684LNMP\u670d\u52a1\u5668\u5df2\u7ecf\u642d\u5efa\u597d\uff0c\u4e14\u57df\u540dwww.aaa.com \uff0cwww.bbb.com\u90fd\u5df2\u7ecf\u7ed1\u5b9a\u5230\u672c\u670d\u52a1\u5668\uff0c<\/p>\n<p>\u73b0\u5728\u60f3\u628awww.aaa.com\u57df\u540d301\u91cd\u5b9a\u5411\u5230www.bbb.com<\/p>\n<p>\u5148\u5728\/usr\/local\/nginx\/conf\/vhost\u627e\u5230www.aaa.com.conf ,\u7528vi\u6253\u5f00\u663e\u793a\u5982\u4e0b\uff1a<\/p>\n<pre class=\"prettyprint linenums\" >\nserver<br \/>\n        {<br \/>\n                listen 80;<br \/>\n                server_name www.aaa.com;<br \/>\n                index index.html index.htm index.php default.html default.htm de                                                                             fault.php;<br \/>\n                root  \/home\/wwwroot\/www.aaa.com;<\/p>\n<p>                include none.conf;<br \/>\n                #error_page   404   \/404.html;<br \/>\n                location ~ [^\/]\\.php(\/|<span class=\"katex math inline\">)<br \/>\n                        {<br \/>\n                                # comment try_files<\/span>uri =404; to enable pathinf                                                                             o<br \/>\n                                try_files <span class=\"katex math inline\">uri =404;<br \/>\n                                fastcgi_pass  unix:\/tmp\/php-cgi.sock;<br \/>\n                                fastcgi_index index.php;<br \/>\n                                include fastcgi.conf;<br \/>\n                                #include pathinfo.conf;<br \/>\n                        }<\/p>\n<p>                location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf)<\/span><br \/>\n                        {<br \/>\n                                expires      30d;<br \/>\n                        }<\/p>\n<p>                location ~ .*\\.(js|css)?$<br \/>\n                        {<br \/>\n                                expires      12h;<br \/>\n                        }<\/p>\n<p>                access_log off;<br \/>\n        }<\/p>\n<p>\u5728\u7f16\u8f91\u6a21\u5f0f\u4e0b\u628aserver_name www.aaa.com;\u8fd9\u884c\u5220\u9664\uff0c<\/p>\n<p>\u540c\u65f6\u52a0\u5165<\/p>\n<pre class=\"prettyprint linenums\" >\nserver {<br \/>\n    server_name www.aaa.com;<br \/>\n    return 301 <span class=\"katex math inline\">scheme:\/\/www.bbb.com<\/span>request_uri;<br \/>\n}<\/p>\n<p>\u5c31\u53ef\u4ee5\u4e86\uff0c\u6700\u7ec8\u4fee\u6539\u540e\u7684\u6587\u4ef6\u5982\u4e0b\uff1a<\/p>\n<pre class=\"prettyprint linenums\" >\nserver<br \/>\n        {<br \/>\n                listen 80;<br \/>\n                index index.html index.htm index.php default.html default.htm de                                                                             fault.php;<br \/>\n                root  \/home\/wwwroot\/www.aaa.com;<\/p>\n<p>                include none.conf;<br \/>\n                #error_page   404   \/404.html;<br \/>\n                location ~ [^\/]\\.php(\/|<span class=\"katex math inline\">)<br \/>\n                        {<br \/>\n                                # comment try_files<\/span>uri =404; to enable pathinf                                                                             o<br \/>\n                                try_files <span class=\"katex math inline\">uri =404;<br \/>\n                                fastcgi_pass  unix:\/tmp\/php-cgi.sock;<br \/>\n                                fastcgi_index index.php;<br \/>\n                                include fastcgi.conf;<br \/>\n                                #include pathinfo.conf;<br \/>\n                        }<\/p>\n<p>                location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf)<\/span><br \/>\n                        {<br \/>\n                                expires      30d;<br \/>\n                        }<\/p>\n<p>                location ~ .*\\.(js|css)?<span class=\"katex math inline\">{<br \/>\n                                expires      12h;<br \/>\n                        }<\/p>\n<p>                access_log off;<br \/>\n        }<\/p>\n<p>server {<br \/>\n    server_name www.aaa.com;<br \/>\n    return 301<\/span>scheme:\/\/www.bbb.com$request_uri;<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5047\u8bbe\u4f60\u7684LNMP\u670d\u52a1\u5668\u5df2\u7ecf\u642d\u5efa\u597d\uff0c\u4e14\u57df\u540dwww.aaa.com \uff0cwww.bbb.com\u90fd\u5df2\u7ecf\u7ed1\u5b9a\u5230\u672c\u670d\u52a1\u5668\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":[],"tags":[],"class_list":["post-1580","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1580"}],"version-history":[{"count":0,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1580\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1580"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}