{"id":1292,"date":"2023-07-12T15:49:23","date_gmt":"2023-07-12T07:49:23","guid":{"rendered":"https:\/\/aichh.com\/?p=1292"},"modified":"2023-07-12T15:49:23","modified_gmt":"2023-07-12T07:49:23","slug":"%e4%bd%bf%e7%94%a8cdn%e5%8a%a0%e9%80%9fplex%e6%92%ad%e6%94%be","status":"publish","type":"post","link":"https:\/\/aichh.com\/1292.html","title":{"rendered":"\u4f7f\u7528CDN\u52a0\u901fPlex\u64ad\u653e"},"content":{"rendered":"<!--wp-compress-html--><!--wp-compress-html no compression--><h2>\u4e00.\u8d77\u56e0<\/h2>\n<p>\u73a9\u670d\u52a1\u5668\u591a\u7684\u4eba\u4e00\u822c\u90fd\u89c1\u8fc7\u4e00\u5f20\u5728\u5708\u5b50\u91cc\u6d41\u4f20\u7684\u56fe\uff0c\u5c31\u662f\u5728\u7a33\u5b9a\u3001\u901f\u5ea6\u3001\u4ef7\u683c\u8fd9\u4e09\u8005\u4e4b\u95f4\u53d6\u820d\u7684\u97e6\u6069\u56fe\u3002\u7531\u4e8e\u5229\u7528Plex\u642d\u5efa\u5728\u7ebf\u89c6\u9891\u670d\u52a1\u5668\u672c\u8eab\u53ea\u662f\u6211\u62ff\u6765\u5229\u7528\u95f2\u7f6e\u670d\u52a1\u5668\u7684\u4e00\u4e2a\u9879\u76ee\uff0c\u6240\u4ee5\u4e5f\u6ca1\u6253\u7b97\u6254\u592a\u591a\u94b1\u5728\u4e0a\u9762\uff0c\u8fd9\u4e5f\u5c31\u610f\u5473\u7740\uff0c\u8fd9\u53f0\u673a\u5668\u5fc5\u7136\u4f1a\u5728 \u901f\u5ea6\u6216\u8005\u7a33\u5b9a\u5176\u4e2d\u4e00\u8005\u4e0a\u6709\u6240\u53d6\u820d\u3002\u800c\u6211\u9009\u62e9\u7684\u662f\u7a33\u5b9a\uff0c\u6240\u4ee5\u4e48\uff0c\u901f\u5ea6\u4e5f\u5c31\u6ca1\u90a3\u4e48\u597d\u4e86\u3002<\/p>\n<h2>\u4e8c.\u5206\u6790<\/h2>\n<p>\u6211\u62ff\u6765\u8dd1Plex\u7684\u670d\u52a1\u5668\u662fKimsufi\u7684K4C\uff0ci5+16G+2T+100M\uff0c\u914d\u7f6e\u662f\u8fd8OK\u7684\uff0c\u5c31\u662f\u5904\u4e8e\u6cd5\u56fd\uff0c\u8fd9\u6837\u7684\u8bdd\u4e2a\u56fd\u5185\u6709\u4e9b\u60c5\u51b5\u4e0b\u901f\u5ea6\u5c31\u6bd4\u8f83\u618b\u5c48\u4e86\uff0c\u867d\u7136\u6211\u914d\u7f6e\u4e86BBR\uff0c\u4f46\u662f\u5728\u90e8\u5206\u7f51\u7edc\u4e0b\u8fd8\u662f\u53ea\u6709500k\u5de6\u53f3\u7684\u901f\u5ea6\uff0c\u867d\u7136\u770b\u4e2a720p\u8fd8\u662f\u6ca1\u95ee\u9898\u7684\uff0c\u4f46\u662f\u62d6\u52a8\u7684\u8bdd\u8fd8\u662f\u6709\u4e9b\u4e0d\u591f\u6d41\u7545\uff0c\u8fd9\u8fdc\u8fdc\u4e0d\u80fd\u8ba9\u6211\u6ee1\u8db3\u3002\u5982\u679c\u662f\u666e\u901a\u7f51\u7ad9\uff0c\u4e3a\u4e86\u52a0\u5feb\u8bbf\u95ee\u901f\u5ea6\u6211\u4eec\u60f3\u5230\u7684\u5c31\u662f\u4e0aCDN\uff0c\u90a3\u4e48Plex\u80fd\u4e0d\u80fd\u8fd9\u4e48\u5e72\u5462\uff1f<\/p>\n<p>\u5f53\u7136\u4e5f\u662f\u53ef\u4ee5\u7684\uff0c\u53ea\u8981CDN\u652f\u6301Websocket\uff0c\u56e0\u4e3aPlex\u7684\u90e8\u5206\u6570\u636e\u662f\u901a\u8fc7WS\u4ece\u670d\u52a1\u5668\u4e0a\u83b7\u53d6\u7684\uff0c\u53ea\u8981\u60f3\u529e\u6cd5\u8ba9WebSocket\u901a\u8fc7CDN\u5c06\u7528\u6237\u548c\u670d\u52a1\u5668\u8fde\u63a5\u8d77\u6765\uff0c\u501f\u52a9CDN\u673a\u623f\u7f51\u7edc\u6bd4\u7528\u6237\u5bb6\u7528\u7f51\u7edc\u62e5\u6709\u66f4\u4f18\u5f02\u7684\u8def\u7531\u548c\u5e26\u5bbd\u7684\u4f18\u52bf\uff0c\u6211\u4eec\u5c31\u80fd\u591f\u83b7\u5f97\u6bd4\u76f4\u8fde\u66f4\u5feb\u7684\u64ad\u653e\u901f\u5ea6\u3002<span id=\"more-1121\"><\/span><\/p>\n<h2>\u4e09.\u89e3\u51b3<\/h2>\n<p>\u7814\u7a76\u4e86\u4e0b\u7f51\u4e0a\u7684\u5404\u79cd\u65b9\u6cd5\uff0c\u53d1\u73b0\u4f17\u8bf4\u7eb7\u7ead\u554a\uff0cQuickbox\u7684\u6559\u7a0b\u770b\u4e0a\u53bb\u5f88\u9760\u8c31\uff0c\u5176\u5b9e\u5e76\u6ca1\u6709\u5375\u7528\uff0c\u590d\u6742\u7684\u8981\u6b7b\uff0c\u6709\u4e2aGithub\u4e0a\u7684\u6559\u7a0b\u5c31\u5f88\u7b80\u5355\u4e5f\u5f88\u6709\u6548\u3002<\/p>\n<p>\u5730\u5740\u5728\u8fd9 https:\/\/github.com\/toomuchio\/<a class=\"st_tag internal_tag\" title=\"Posts tagged with plex\" href=\"http:\/\/www.senra.me\/tag\/plex\/\" rel=\"tag\">plex<\/a>-nginx-reverseproxy<\/p>\n<p>\u4ed6\u8fd9\u4e2a\u4e3b\u8981\u5c31\u662f\u4e2anginx\u7684vhost\u914d\u7f6e\u6587\u4ef6\uff0c\u7136\u540e\u8fd8\u6709\u4e9b\u8bf4\u660e\uff0c\u6211\u6765\u7b80\u5355\u4ecb\u7ecd\u4e0b\u6d41\u7a0b\u3002<br \/>\n\u600e\u4e48\u5728\u673a\u5668\u4e0a\u5b89\u88c5nginx\u6211\u5c31\u4e0d\u63d0\u4e86\u5427\uff0c\u592a\u7b80\u5355\u4e86\uff0c\u968f\u4fbf\u4f60\u7528\u6e90\u88c5\u8fd8\u662f\u7528\u5404\u79cdlnmp\u5305\u5565\u7684\u88c5\uff0c\u53cd\u6b63\u53ea\u9700\u8981\u4e00\u4e2anginx\u672c\u4f53\u3002<\/p>\n<p>\u4fee\u6539\u4e0b https:\/\/github.com\/toomuchio\/<a class=\"st_tag internal_tag\" title=\"Posts tagged with plex\" href=\"http:\/\/www.senra.me\/tag\/plex\/\" rel=\"tag\">plex<\/a>-nginx-reverseproxy\/raw\/master\/nginx.conf \u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\uff0c\u6ce8\u610f\u8fd9\u4e2a\u4e0d\u662f\u66ff\u4ee3\u4f60\u7684nginx.conf\u7684\uff0c\u8fd9\u6837\u4e0d\u592a\u597d\uff0c\u6211\u5efa\u8bae\u628a\u5b83\u4f5c\u4e3a\u6a21\u677f\u6765\u4fee\u6539\u4f60\u65b0\u5efa\u7684vhost\uff0c\u4e0b\u9762\u662f\u6211\u6539\u7684<\/p>\n<pre>upstream plex_backend {\r\n server 127.0.0.1:32400;\r\n keepalive 32;\r\n}\r\n\r\nserver {\r\n listen 80;\r\n listen 443 ssl http2;\r\n server_name plex.server;\r\n\r\n access_log off;\r\n send_timeout 100m;\r\n resolver 8.8.4.4 8.8.8.8 valid=300s;\r\n resolver_timeout 10s;\r\n\r\n ssl_certificate \/usr\/local\/nginx\/conf\/ssl\/plex.server.crt;\r\n ssl_certificate_key \/usr\/local\/nginx\/conf\/ssl\/plex.server.key;\r\n ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\r\n ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;\r\n ssl_prefer_server_ciphers on;\r\n ssl_session_timeout 10m;\r\n ssl_session_cache builtin:1000 shared:SSL:10m;\r\n ssl_buffer_size 1400;\r\n ssl_stapling on;\r\n ssl_stapling_verify on;\r\n ssl_session_tickets on;\r\n\r\n gzip on;\r\n gzip_vary on;\r\n gzip_min_length 1000;\r\n gzip_proxied any;\r\n gzip_types text\/plain text\/css text\/xml application\/xml text\/javascript application\/x-javascript image\/svg+xml;\r\n gzip_disable \"MSIE [1-6].\";\r\n\r\n client_max_body_size 100M;\r\n\r\n #Forward real ip and host to Plex\r\n proxy_set_header Host $host;\r\n proxy_set_header X-Real-IP $remote_addr;\r\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n proxy_set_header X-Forwarded-Proto $scheme;\r\n\r\n #Websockets\r\n proxy_http_version 1.1;\r\n proxy_set_header Upgrade $http_upgrade;\r\n proxy_set_header Connection \"upgrade\";\r\n\r\n #Disables compression between Plex and Nginx, required if using sub_filter below.\r\n #May also improve loading time by a very marginal amount, as nginx will compress anyway.\r\n #\u5173\u95edPlex\u7a0b\u5e8f\u5230Nginx\u4e4b\u95f4\u7684gzip\u538b\u7f29\r\n #proxy_set_header Accept-Encoding \"\";\r\n\r\n #Buffering off send to the client as soon as the data is received from Plex.\r\n #\u5173\u95ed\u7f13\u51b2\uff0c\u9632\u6b62\u51fa\u95ee\u9898\r\n proxy_redirect off;\r\n proxy_buffering off;\r\n\r\nlocation \/ {\r\n #Example of using sub_filter to alter what Plex displays, this disables Plex News.\r\n #\u8fd9\u90e8\u5206\u5185\u5bb9\u66ff\u6362\u662f\u4e3a\u4e86\u53bb\u9664Plex\u7684News\uff0c\u53ef\u4ee5\u4e0d\u7528\u7ba1\uff0c\u5982\u679c\u8981\u7528\u8fd9\u4e2a\u5fc5\u987b\u628a\u4e0a\u9762\u7684\u538b\u7f29\u7ed9\u5173\u6389\uff0c\u4e0d\u7136gzip\u538b\u7f29\u540e\u7684\u5185\u5bb9\u65e0\u6cd5\u68c0\u7d22\u5230\u5185\u5bb9\u6210\u529f\u66ff\u6362\r\n #sub_filter ',news,' ',';\r\n #sub_filter_once on;\r\n #sub_filter_types text\/xml;\r\n proxy_pass http:\/\/plex_backend;\r\n }\r\n\r\n #PlexPy forward example, works the same for other services.\r\n #\u7528\u4e8e\u5c06PlexPy\u540c\u65f6\u53cd\u4ee3\uff0c\u5173\u4e8ePlexPy\u8fd9\u4e2a\u53ef\u4ee5\u53c2\u8003\u6211\u7b2c\u4e00\u7bc7Plex\u6587\u7ae0\u7684\u540e\u534a\u90e8\u5206\u5185\u5bb9\r\n #location \/plexpy {\r\n # proxy_pass http:\/\/127.0.0.1:8181;\r\n #}\r\n}<\/pre>\n<p>\u8bb0\u5f97\u628aSSL\u548cServer_name\u5565\u7684\u7ed9\u6539\u4e86\uff0c\u5176\u4ed6\u53ef\u4ee5\u76f4\u63a5\u7528\u6765\u7740\u3002<\/p>\n<p>\u6211\u628aGitHub\u4e0a\u7684\u914d\u7f6e\u91cc\u90a3\u4e2aglobal\u7684ssl\u7f13\u5b58\u8bbe\u7f6e\u7ed9\u4e22\u5230\u4e86server\u6bb5\uff0c\u8fd9\u4e2a\u53ea\u8981\u4f60nginx.conf\u91cc\u9762\u6ca1\u6709\u5b9a\u4e49\u8fc7\u653e\u5230server\u91cc\u9762\u662f\u4e0d\u4f1a\u51b2\u7a81\u7684\uff0c\u4e0d\u7136server\u6bb5\u914d\u7f6e\u7684\u7f13\u5b58\u5927\u5c0f\u53d7global\u9650\u5236\uff0c\u4e0d\u80fd\u8d85\u8fc7\u3002<\/p>\n<p>\u7136\u540e\u6709\u4e9bHSTS\u5565\u7684\u56e0\u4e3a\u6211\u6253\u7b97\u7528\u767e\u5ea6\u4e91\u52a0\u901f\uff0c\u514d\u8d39\u5957\u9910\u4e0d\u652f\u6301https\uff0c\u6240\u4ee5\u5c31\u6ca1\u6709\u52a0\u4e0a\uff0c\u53e6\u5916\u90e8\u5206\u5e73\u53f0\u7684plex\u4e0d\u652f\u6301https\uff0c\u6bd4\u5982roku\u548cps4\u4e0a\u7684\uff0c\u5177\u4f53\u53ef\u4ee5\u53c2\u8003\u8fd9\u4e2aissue \u2014\u2014&gt;<a href=\"https:\/\/github.com\/toomuchio\/plex-nginx-reverseproxy\/issues\/5\" target=\"_blank\" rel=\"noopener\">\u4f20\u9001\u95e8<\/a><\/p>\n<p>\u8fd8\u6709ssl\u8bc1\u4e66\u7684\u8bdd\u53ef\u4ee5\u7528let's encrypt\u7684\uff0c\u7b7e\u53d1\u53ef\u4ee5\u7528acme.sh\uff0c\u8fd9\u4e2a\u6211\u5c31\u4e0d\u4ecb\u7ecd\u4e86\u3002<\/p>\n<p>\u5728\u914d\u7f6e\u5b8cnginx\u53cd\u4ee3\u540e\uff0c\u6211\u4eec\u5c31\u80fd\u901a\u8fc7\u53cd\u4ee3\u7684\u57df\u540d\u8bbf\u95eeplex\u4e86\uff0c\u6d4b\u8bd5\u4e0b\u5148\uff0c\u7136\u540e\u6211\u4eec\u505a\u4e9b\u4fee\u6539\u3002<\/p>\n<blockquote><p>Remote Access - Disable<br \/>\nNetwork - Custom server access URLs = https:\/\/&lt;your-domain&gt;:443,http:\/\/&lt;your-domain&gt;:80<br \/>\nNetwork - Secure connections = Preferred.<br \/>\n#f03c15 Note you can force SSL by setting required and not adding the HTTP URL, however some players which do not support HTTPS (e.g: Roku, Playstations, some SmartTVs) will no longer function.<\/p><\/blockquote>\n<p>\u5c31\u662f\u5728\u8fdc\u7a0b\u8bbf\u95ee\u90a3\u513f\u7981\u7528\u8fdc\u7a0b\u8bbf\u95ee(\u5f00\u4e86\u7684\u8bddPlex\u4f1a\u628aIP\u4e0a\u62a5\u7ed9Plex\u7684\u5b98\u65b9\u670d\u52a1\u5668\uff0c\u7136\u540e\u4f60\u9ed8\u8ba4\u4f1a\u7528\u7aef\u53e3\u8fde\u90a3\u4e2aIP\uff0c\u800c\u4e0d\u662f\u8d70CDN)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"15191034234645\" src=\"https:\/\/aichh.com\/wp-content\/uploads\/2023\/07\/15191034234645.jpg\" width=\"2372\" height=\"1280\"><\/p>\n<p>\u7136\u540e\u5728\u7f51\u7edc\u90a3\u513f\u914d\u7f6e\u8bbf\u95ee\u5730\u5740Custom server access URLs (\u5982\u679c\u6ca1\u770b\u89c1\u8fd9\u4e2a\u8bf7\u70b9\u51fb\u53f3\u4e0a\u65b9\u7684\u663e\u793a\u9ad8\u7ea7\u9009)\uff0c\u8fd9\u4e2a\u53ef\u4ee5\u7528\u9017\u53f7\u6765\u5206\u9694\u6dfb\u52a0\u591a\u4e2a\u5730\u5740\uff0c\u6bd4\u5982http\u548chttps\u7684(https:\/\/&lt;your-domain&gt;:443,http:\/\/&lt;your-domain&gt;:80)\uff0c\u8bb0\u5f97\u5e26\u4e0a\u7aef\u53e3\uff0c\u81f3\u4e8e\u90a3\u4e2aSecure connections\u770b\u4f60\u9700\u6c42\uff0c\u5982\u679c\u4e0d\u7528https\u5c31\u7981\u7528\u6389\uff0c\u652f\u6301\u53ef\u4ee5\u5f00preferred\uff0c\u4e0d\u5efa\u8bae\u5f00\u5fc5\u987b\uff0c\u8fd9\u6837\u517c\u5bb9\u6027\u4e0d\u597d\u3002<\/p>\n<p>\u914d\u7f6e\u5b8c\u6210\u540e\u5efa\u8bae\u7528\u9632\u706b\u5899\u5173\u6389\u5916\u90e8\u8bbf\u95ee32400\u7aef\u53e3\uff0c\u9632\u6b62\u90e8\u5206\u5e73\u53f0\u4e0d\u7ba1\u914d\u7f6e\u7684 Custom server access URLs \u800c\u4f18\u5148\u76f4\u63a5\u8bbf\u95ee32400(\u5f53\u7136\uff0c\u4e0a\u4e86cdn\u7684\u60c5\u51b5\u4e0b\u662f\u8bbf\u95ee\u4e0d\u901a\u7684)<\/p>\n<p>\u8fd9\u662fiptables\u547d\u4ee4\uff0c\u7981\u6b62\u975e\u672c\u5730\u8bbf\u95ee32400\u7684<\/p>\n<pre>iptables -A INPUT ! -i lo -p tcp --dport 32400 -j DROP<\/pre>\n<p>\u7136\u540e\u4f60\u5c31\u53ef\u4ee5\u4eab\u53d7\u5237\u5237\u5237\u7684\u8bbf\u95ee\u901f\u5ea6\u4e86\uff0c\u5f53\u7136\uff0c\u4f60\u4f1a\u8bb0\u5f97\u5728cdn\u90a3\u8fb9\u6dfb\u52a0\u57df\u540d\u7684\u5bf9\u5427<\/p>\n<p>\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u4e0a\u4e86CDN\u4e4b\u540e\u6211\u80fd\u591f\u8fbe\u5230\u5cf0\u503c10M\/s\uff0c\u7a33\u5b9a3-4m\/s\u76844k\u64ad\u653e\uff0c\u6548\u679c\u8fd8\u662f\u5f88\u68d2\u7684\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"15191111528648\" src=\"https:\/\/aichh.com\/wp-content\/uploads\/2023\/07\/15191111528648.jpg\" width=\"2560\" height=\"1317\"><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.senra.me\/\">Senra\u306e\u5c0f\u7a9d<\/a>\u539f\u521b<\/p>\n<p>&nbsp;<\/p>\n<!--wp-compress-html no compression--><!--wp-compress-html-->","protected":false},"excerpt":{"rendered":"\u4e00.\u8d77\u56e0 \u73a9\u670d\u52a1\u5668\u591a\u7684\u4eba\u4e00\u822c\u90fd\u89c1\u8fc7\u4e00\u5f20\u5728\u5708\u5b50\u91cc\u6d41\u4f20\u7684\u56fe\uff0c\u5c31\u662f\u5728\u7a33\u5b9a\u3001\u901f\u5ea6\u3001\u4ef7\u683c\u8fd9\u4e09\u8005\u4e4b\u95f4\u53d6\u820d\u7684\u97e6\u6069\u56fe\u3002\u7531\u4e8e\u5229\u7528Plex\u642d\u5efa\u5728\u7ebf\u89c6\u9891\u670d\u52a1\u5668\u672c\u8eab\u53ea\u662f\u6211\u62ff\u6765\u5229\u7528\u95f2\u7f6e\u670d\u52a1\u5668\u7684\u4e00\u4e2a\u9879\u76ee\uff0c\u6240\u4ee5\u4e5f\u6ca1\u6253\u7b97\u6254\u592a\u591a\u94b1\u5728\u4e0a \u00b7\u00b7\u00b7","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[331,132,345],"class_list":["post-1292","post","type-post","status-publish","format-standard","hentry","category-jiaocheng","tag-plex","tag-132","tag-345"],"views":334,"_links":{"self":[{"href":"https:\/\/aichh.com\/api\/wp\/v2\/posts\/1292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aichh.com\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aichh.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aichh.com\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aichh.com\/api\/wp\/v2\/comments?post=1292"}],"version-history":[{"count":1,"href":"https:\/\/aichh.com\/api\/wp\/v2\/posts\/1292\/revisions"}],"predecessor-version":[{"id":1295,"href":"https:\/\/aichh.com\/api\/wp\/v2\/posts\/1292\/revisions\/1295"}],"wp:attachment":[{"href":"https:\/\/aichh.com\/api\/wp\/v2\/media?parent=1292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aichh.com\/api\/wp\/v2\/categories?post=1292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aichh.com\/api\/wp\/v2\/tags?post=1292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}