{"id":24642,"date":"2020-02-13T17:53:41","date_gmt":"2020-02-13T09:53:41","guid":{"rendered":"http:\/\/4563.org\/?p=24642"},"modified":"2020-02-13T17:53:41","modified_gmt":"2020-02-13T09:53:41","slug":"%e3%80%90%e6%95%99%e7%a8%8b%e3%80%91nginx%e5%8f%8d%e4%bb%a3-%e5%8a%a0%e9%80%9f%e5%9e%83%e5%9c%be%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=24642","title":{"rendered":"\u3010\u6559\u7a0b\u3011Nginx\u53cd\u4ee3 \u52a0\u901f\u5783\u573e\u670d\u52a1\u5668"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>net777<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>\u3010\u6559\u7a0b\u3011Nginx\u53cd\u4ee3 \u52a0\u901f\u5783\u573e\u670d\u52a1\u5668<\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 net777 \u4e8e 2020-2-13 18:10 \u7f16\u8f91 <\/p>\n<p> \u6211\u4eec\u5148\u8981\u641e\u6e05\u695aNginx\u53cd\u4ee3\u5982\u4f55\u8fdb\u884c\u5de5\u4f5c<\/p>\n<p>  \u5ba2\u6237\u5230Nginx\u53cd\u4ee3\u670d\u52a1\u5668<br \/>  Nginx\u53cd\u4ee3\u670d\u52a1\u5668\u5230\u6e90\u670d\u52a1\u5668\u62ff\u6570\u636e<br \/>  Nginx\u53cd\u4ee3\u670d\u52a1\u5668\u5728\u7ed9\u5ba2\u6237\u53d1\u9001\u6570\u636e<\/p>\n<p>  \u5173\u4e8e\u66f4\u65b0\u7f13\u5b58 \u8981\u5b89\u88c5\u7f13\u5b58\u6e05\u9664\u6a21\u5757ngx_cache_purge<br \/>  \u56e0\u4e3a\u6211\u81ea\u5df1\u4e5f\u6ca1\u7814\u7a76\u7684\u7279\u522b\u900f\u5f7b \u5c31\u4e0d\u7ed9\u5927\u5bb6\u793a\u8303\u4e86<\/p>\n<p>  \u5927\u5bb6\u53ef\u4ee5\u770b\u770b\u6211\u901a\u8fc7Nginx\u53cd\u4ee3\u642d\u5efa\u7684\u7f51\u7ad9<\/p>\n<p>  www.tv772.com<\/p>\n<p>  \u6211\u4eec\u6765\u5f00\u59cb\u6559\u7a0b<\/p>\n<p>  \u8fd9\u91cc\u6309Centos 7\u6765<\/p>\n<p>  \u5b89\u88c5<\/p>\n<p>  1\u3001\u5b89\u88c5Nginx<\/p>\n<p>  \u6211\u4eec\u5148\u5b89\u88c5\u519b\u54e5\u7684Lnmp<\/p>\n<p>  wget http:\/\/soft.vpser.net\/lnmp\/lnmp1.6.tar.gz -cO lnmp1.6.tar.gz &amp;&amp; tar zxf lnmp1.6.tar.gz &amp;&amp; cd lnmp1.6 &amp;&amp; .\/install.sh lnmp<\/p>\n<p>  2\u3001CDN\u914d\u7f6e<\/p>\n<p>  \u5047\u5982\u6211\u9700\u8981\u5bf9www.tv772.com\u642d\u5efa\u53cd\u4ee3\u8282\u70b9\uff0c\u6570\u636e\u653e\u5728192.168.1.1\uff0c\u9700\u8981\u5148\u4fee\u6539hosts\u6307\u5411\uff0c\u544a\u77e5\u53cd\u4ee3\u8282\u70b9\u53bb\u54ea\u91cc\u53bb\u83b7\u53d6\u56de\u6e90\u5730\u5740\uff0c\u505a\u5982\u4e0b\u4fee\u6539\uff1a<\/p>\n<p>  vi \/etc\/hosts<br \/>  192.168.1.1&nbsp; &nbsp; www.tv772.com<\/p>\n<p>  \u7136\u540e\u521b\u5efanginx\u914d\u7f6e\u6587\u4ef6tv772.com.conf<\/p>\n<p>  #\u521b\u5efa\u7f13\u5b58\u76ee\u5f55<br \/>  mkdir -p \/data\/wwwroot\/caches\/www.tv772.com<br \/>  #\u8bbe\u7f6e\u7f13\u5b58\u76ee\u5f55\u6743\u9650<br \/>  chown -R www:www \/data\/wwwroot\/caches\/www.tv772.com<br \/>  #\u521b\u5efatv772.com.conf<br \/>  vi \/usr\/local\/nginx\/conf\/vhost\/tv772.com.conf<\/p>\n<p>  \u5728tv772.com.conf\u4e2d\u6dfb\u52a0\u4e0b\u9762\u7684\u5185\u5bb9\uff0c\u7f13\u5b58\u76ee\u5f55\/\u7f13\u5b58\u65f6\u95f4\u8bf7\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8c03\u6574\u3002<\/p>\n<p>  proxy_cache_path \/data\/wwwroot\/caches\/www.tv772.com levels=1:2 keys_zone=Rats:50m inactive=30m max_size=50m;<br \/>  server {<br \/>  &nbsp; &nbsp; listen 80;<br \/>  &nbsp; &nbsp; server_name www.tv772.com;<br \/>  &nbsp; &nbsp; charset utf-8,gbk;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;location \/ {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_set_header Accept-Encoding &quot;&quot;;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_pass https:\/\/www.tv772.com;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_redirect off;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_set_header X-Real-IP $remote_addr;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_cache Rats;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_cache_valid200 30430m;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_cache_valid301 24h;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_cache_valid500 502 503 504 0s;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_cache_valid any 1s;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;proxy_cache_min_uses 1;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;expires 12h;<br \/>  &nbsp; &nbsp; }<br \/>  }<\/p>\n<p>  \u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n<p>  \/data\/wwwroot\/caches\/www.tv772.com\uff1a\u4e3a\u7f13\u5b58\u76ee\u5f55<br \/>  levels\uff1a\u6307\u5b9a\u8be5\u7f13\u5b58\u7a7a\u95f4\u6709\u4e24\u5c42hash\u76ee\u5f55\uff0c\u7b2c\u4e00\u5c42\u76ee\u5f55\u4e3a1\u4e2a\u5b57\u6bcd\uff0c\u7b2c\u4e8c\u5c42\u4e3a2\u4e2a\u5b57\u6bcd\u3002<br \/>  keys_zone=Rats:50m\uff1a\u4e3a\u7f13\u5b58\u7a7a\u95f4\u8d77\u4e2a\u540d\u5b57\uff0c\u8fd9\u91cc\u53d6\u540d\u4e3a\u201cRats\u201d\uff0c\u540e\u9762\u768450m\u6307\u5185\u5b58\u7f13\u5b58\u7a7a\u95f4<br \/>  inactive=30m\uff1a\u5982\u679c30\u5206\u949f\u5185\u8be5\u8d44\u6e90\u6ca1\u6709\u88ab\u8bbf\u95ee\u5219\u5220\u9664<br \/>  max_size=50m\uff1a\u6307\u786c\u76d8\u7f13\u5b58\u5927\u5c0f\u4e3a50MB<br \/>  proxy_cache_valid\uff1a\u6307\u5b9a\u72b6\u6001\u7801\u7f13\u5b58\u65f6\u95f4\uff0c\u524d\u9762\u5199\u72b6\u6001\u7801\uff0c\u540e\u9762\u5199\u7f13\u5b58\u65f6\u95f4\u3002<\/p>\n<p>  \u7136\u540e\u91cd\u542fNginx\u751f\u6548<\/p>\n<p>  lnmp nginx reload<\/p>\n<p>  \u4f7f\u7528\u591a\u53f0VPS\uff0c\u5229\u7528DNSPod\u667a\u80fd\u89e3\u6790\uff0c\u5c06\u4e0d\u540c\u5730\u533a\u7684DNS\u89e3\u6790\u5230\u6700\u8fd1\u7684VPS\u4e0a\uff0c\u8fdb\u884cCND\u52a0\u901f\u3002\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u963f\u62c9\u4e01\u795e\u5751<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u9876\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>cquyf<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u66f4\u65b0\u7f13\u5b58\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>wolfewong<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tmark\uff0c\u4ee5\u540e\u6162\u6162\u770b\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>imsun<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7eff\u8272\u5b57\u770b\u7684\u773c\u775b\u5f88\u523a\u4e0d\u89c9\u5f97\u5417\uff1f\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>seal0207<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tmark\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>heu<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tmark \u5b57\u6570\u8865\u4e01yc007t\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>net777<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tcquyf \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-2-13 17:36<br \/>  \u66f4\u65b0\u7f13\u5b58\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f<\/p>\n<p> \u5173\u4e8e\u66f4\u65b0\u7f13\u5b58 \u8981\u5b89\u88c5\u7f13\u5b58\u6e05\u9664\u6a21\u5757ngx_cache_purge<br \/>  \u56e0\u4e3a\u6211\u81ea\u5df1\u4e5f\u6ca1\u7814\u7a76\u7684\u7279\u522b\u900f\u5f7b \u5c31\u4e0d\u7ed9\u5927\u5bb6\u793a\u8303\u4e86\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>snx<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tcquyf \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-2-13 17:36<br \/>  \u66f4\u65b0\u7f13\u5b58\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f<\/p>\n<p> \u6839\u636e key \u751f\u6210\u7684md5\u627e\u5230\u5bf9\u5e94\u6587\u4ef6\uff0c\u7136\u540e\u5220\u9664\u3002<br \/>  \u6216\u8005 \u904d\u5386\u6587\u4ef6 \u627e\u5230\u5bf9\u5e94\u6587\u4ef6\u5220\u9664(\u4f1a\u5360\u7528\u8f83\u591aCPU)\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>net777<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\timsun \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-2-13 17:37<br \/>  \u7eff\u8272\u5b57\u770b\u7684\u773c\u775b\u5f88\u523a\u4e0d\u89c9\u5f97\u5417\uff1f<\/p>\n<p> \u542c\u53d6\u5927\u4f6c\u7684\u610f\u89c1 \u5df2\u7ecf\u6539\u6389\u4e86\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>net777 \u5927\u4f6c\u6709\u8bdd\u8bf4 : \u3010\u6559&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\/24642"}],"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=24642"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/24642\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24642"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}