{"id":341222,"date":"2021-02-16T22:40:21","date_gmt":"2021-02-16T14:40:21","guid":{"rendered":"http:\/\/4563.org\/?p=341222"},"modified":"2021-02-16T22:40:21","modified_gmt":"2021-02-16T14:40:21","slug":"nginx-%e8%83%bd%e5%90%a6%e5%b0%86%e6%9c%ac%e5%9c%b0%e7%9a%84%e5%a4%9a%e4%b8%aa%e7%ab%af%e5%8f%a3%e8%bd%ac%e5%8f%91%e5%88%b0%e5%90%8c%e4%b8%80%e7%ab%af%e5%8f%a3%e7%9a%84%e4%b8%8d%e5%90%8c%e7%9b%ae","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=341222","title":{"rendered":"Nginx \u80fd\u5426\u5c06\u672c\u5730\u7684\u591a\u4e2a\u7aef\u53e3\u8f6c\u53d1\u5230\u540c\u4e00\u7aef\u53e3\u7684\u4e0d\u540c\u76ee\u5f55"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Nginx \u80fd\u5426\u5c06\u672c\u5730\u7684\u591a\u4e2a\u7aef\u53e3\u8f6c\u53d1\u5230\u540c\u4e00\u7aef\u53e3\u7684\u4e0d\u540c\u76ee\u5f55               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nellxzy <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u73a9\u6811\u8393\u6d3e\u9047\u5230\u7684\u95ee\u9898\uff0c\u81ea\u5df1\u67e5\u4e86\u5f88\u4e45\u8d44\u6599\u6ca1\u641e\u5b9a\uff0c\u6c42\u6c42\u8bba\u575b\u7684\u5404\u4f4d\u5927\u795e\u6307\u70b9\uff01<\/p>\n<h3>\u80cc\u666f<\/h3>\n<p>\u8bbe\u5907\u662f\u6811\u8393\u6d3e\uff0c\u7528\u4e86\u82b1\u751f\u58f3\u7684\u5185\u7f51\u7a7f\u900f\uff0c\u514d\u8d39\u7248\u53ea\u63d0\u4f9b\u4e24\u4e2a\u7aef\u53e3\uff0cSSH \u7528\u6389\u4e00\u4e2a 22 \u7aef\u53e3\uff0c\u73b0\u5728\u53ea\u5269\u4e00\u4e2a\u7aef\u53e3\u4e86\u3002<\/p>\n<p>\u6211\u6709\u5982\u4e0b\u670d\u52a1\uff1a<\/p>\n<ul>\n<li>Jupyter\uff1a<code>http:\/\/localhost:8888<\/code><\/li>\n<li>Aria2 \u7684 RPC\uff1a<code>http:\/\/localhost:6800\/jsonrpc<\/code><\/li>\n<li>\u5176\u4ed6\u67d0\u670d\u52a1\uff1a<code>http:\/\/localhost:5299<\/code><\/li>\n<li>Aria-NG\uff1a\u57fa\u4e8e Nginx\uff0c<code>http:\/\/localhost\/aria-ng<\/code><\/li>\n<\/ul>\n<p>\u53d7\u5230 Aria-NG \u7684\u542f\u53d1\uff0c\u6240\u4ee5\u6211\u5728\u60f3\u80fd\u4e0d\u80fd\u7528 Nginx \u5b9e\u73b0\u5982\u4e0b\u8f6c\u53d1\uff1a<\/p>\n<ul>\n<li>Jupyter\uff1a<code>http:\/\/localhost\/jupyter<\/code><\/li>\n<li>Aria2 \u7684 RPC\uff1a<code>http:\/\/localhost\/jsonrpc<\/code><\/li>\n<li>\u5176\u4ed6\u67d0\u670d\u52a1\uff1a<code>http:\/\/localhost\/xxx<\/code><\/li>\n<li>Aria-NG\uff1a<code>http:\/\/localhost\/aria-ng<\/code><\/li>\n<\/ul>\n<p>\u6211\u67e5\u5230 Nginx \u7684\u9ed8\u8ba4\u7aef\u53e3\u662f 80\uff0c\u5982\u679c\u4e0a\u9762\u53ef\u4ee5\u5b9e\u73b0\u7684\u8bdd\uff0c\u6216\u8bb8\u5c31\u53ef\u4ee5\u53ea\u7528\u4e00\u4e2a 80 \u7aef\u53e3\u6765\u4f7f\u7528\u591a\u4e2a\u670d\u52a1\u3002\uff08\u5e94\u8be5\u662f\u53ef\u4ee5\u7684\uff0c\u6211\u4e4b\u524d\u8bd5\u4e86 80 \u7aef\u53e3\uff0c\u7528 <code>\u5916\u7f51\u57df\u540d:\u5916\u7f51\u7aef\u53e3 \/aria-ng<\/code> \u53ef\u4ee5\u8bbf\u95ee Aria-NG\uff0c\u4f46\u662f\u56e0\u4e3a Aria2 \u7684 RPC \u5728 6800\uff0c\u6240\u4ee5\u53ea\u6709 Aria-NG \u7684\u754c\u9762\uff0c\u6ca1\u6cd5\u5b9e\u9645\u4f7f\u7528\u3002\uff09<\/p>\n<h3>\u76ee\u524d\u7684\u5931\u8d25\u5c1d\u8bd5<\/h3>\n<p>\u5728<code>\/etc\/nginx\/nginx.conf<\/code>\u4e2d\uff0c\u8fdb\u884c\u5982\u4e0b\u4fee\u6539\uff1a<\/p>\n<pre><code>html {  ......          server {         listen 80;         server_name localhost;          # Jupyter Notebook         location \/jupyter {             proxy_pass http:\/\/localhost:8888;             ......         }          # Aria2 JSONRPC         location \/jsonrpc {             proxy_pass http:\/\/localhost:6800\/jsonrpc;             ......         }                  # XXX         location \/xxx {          proxy_pass http:\/\/localhost:5299;             ......     } } <\/code><\/pre>\n<p>\u91cd\u542f nginx \u670d\u52a1\u540e\uff0c\u5728\u6811\u8393\u6d3e\u4e0a\u8bbf\u95ee<code>localhost\/jupyter<\/code>\uff0c\u9519\u8bef 404 \u3002\u5c40\u57df\u7f51\u8bbf\u95ee\u6216\u5916\u7f51\u8bbf\u95ee\u81ea\u7136\u4e5f\u5931\u8d25\u4e86\u3002<\/p>\n<p>\u67e5\u5230\u7684\u8d44\u6599\u57fa\u672c\u4e0a\u90fd\u662f\u4e00\u4e2a\u7aef\u53e3\u6216\u57df\u540d\u8f6c\u53d1\u5230\u53e6\u4e00\u4e2a\u7aef\u53e3\u6216\u57df\u540d\u7684\uff0c\u57fa\u672c\u6ca1\u6709\u6211\u8fd9\u91cc\u7684\u591a\u4e2a\u7aef\u53e3\u8f6c\u53d1\u5230\u540c\u4e00\u7aef\u53e3\u7684\u4e0d\u540c\u76ee\u5f55\u3002\u8fd8\u6709\u4e00\u4e9b\u7528\u5230\u4e86 stream \u6a21\u5757\uff0c\u4f46\u4e5f\u662f\u5c40\u57df\u7f51\u5185\u7684\u7aef\u53e3\u5bf9\u7aef\u53e3\u3002\u53ea\u6709\u8fd9\u4e2a\u5e16\u5b50\u6bd4\u8f83\u50cf\uff1a https:\/\/www.imooc.com\/wenda\/detail\/510191 \uff0c\u4f46\u662f\u6ca1\u6709\u8be6\u7ec6\u7b54\u6848\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u8fd9\u4e2a\u95ee\u9898\u4e0d\u7528\u82b1\u751f\u58f3\u5c31\u80fd\u89e3\u51b3\u4e86\uff0c\u4f46\u8fd8\u662f\u597d\u5947\uff0c\u4e0a\u9762\u63d0\u7684\u65b9\u6848\u6709\u6ca1\u6709\u5b9e\u73b0\u7684\u53ef\u80fd\u6027\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>29<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5270368\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cinhoo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             location \u548c proxy_pass \u6700\u540e\u90fd\u52a0\u4e0a \/\u8bd5\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270369\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : nellxzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @cinhoo \u8bd5\u4e86\u4e00\u4e0b\uff0c\u4e24\u4e2a\u90fd\u52a0 \/\uff0c\u4e24\u4e2a\u5206\u522b\u52a0#\uff0c\u90fd\u6ca1\u6210\u529f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270370\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ashong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             &#8220;`<br \/>location \/jupyter {<br \/> proxy_pass http:\/\/localhost:8888\/;<br \/> &#8230;&#8230;<br \/> }<br \/>&#8220;`<\/p>\n<p>\u5e94\u8be5\u5c31\u53ef\u4ee5\u4e86                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270371\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Kobayashi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u8bb0\u5f97\u9700\u8981\u88ab\u4ee3\u7406\u7684\u670d\u52a1\u652f\u6301\uff0c\u9700\u8981\u901a\u77e5\u88ab\u4ee3\u7406\u670d\u52a1\u5b83\u6b63\u5728\u5de5\u4f5c\u5728\u67d0\u4e2a\u76ee\u5f55\u4e0b\u3002\u5982\u679c\u662f\u5b50\u57df\u540d\u5c31\u6ca1\u6709\u8fd9\u79cd\u9650\u5236\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270372\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : nellxzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ashong \u8fd9\u8fb9\u8fd8\u662f 404                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270373\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Qetesh <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u79cd\u8f6c\u53d1\u4f1a\u628a\u8def\u5f84\u5e26\u8fc7\u53bb\uff0c\u9700\u8981\u5199 rewrite \u3002\u6700\u597d\u7528\u57df\u540d\u505a\u5230\u4e0d\u901a\u7f51\u7ad9\u8bbf\u95ee                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270374\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cz5424 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u662f\u4e0d\u662f docker \u4e0b\uff0cdocker \u4e0b\u5c31\u4e0d\u662f localhost                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270375\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : crclz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5173\u952e\u8bcd nginx rewrite                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270376\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cz5424 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             # Aria2 JSONRPC<br \/> location \/jsonrpc {<br \/> proxy_pass http:\/\/localhost:6800;<br \/> &#8230;&#8230;<br \/> }                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270377\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kingfalse <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u641c Nginx \u8def\u5f84\u8f6c\u53d1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270378\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : snip <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u662f\u81ea\u5df1\u7528\uff0c\u5c31\u7528 ssh \u96a7\u9053\u89e3\u51b3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270379\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dier <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             server_name \u586b\u4e2a\u57df\u540d\uff0c\u7136\u540e\u89e3\u6790\u5230\u82b1\u751f\u58f3\u7684 cname \u6216 IP                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270380\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dier <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u53ea\u6709 localhost\uff0c\u90a3\u5c31\u53ea\u80fd\u901a\u8fc7 localhost \u6765\u8bbf\u95ee                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270381\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dier <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u4e9b\u670d\u52a1\u4e0d\u652f\u6301\u8def\u5f84\u7684\u8bdd\uff0c\u5efa\u8bae\u5206\u6210\u4e0d\u540c\u7684 server{}\u5757\u6765\u533a\u5206\uff0c\u6bcf\u4e00\u5757\u90fd\u80fd\u76d1\u542c 80 \u7aef\u53e3\uff0c\u4fee\u6539\u6210\u5bf9\u5e94\u7684 server_name \u5c31\u53ef\u4ee5\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270382\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : OhYee <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53c2\u8003\u4e0b\u8fd9\u4e2a\u7684\u4f8b\u5b50\uff1f\u8c8c\u4f3c\u95ee\u9898\u5c31\u5728\u53cd\u5411\u4ee3\u7406\u8def\u5f84\u4e0a<\/p>\n<p>https:\/\/segmentfault.com\/a\/1190000022501310                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270383\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chinvo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @dier #13 \u778e\u8bf4\uff0cserver name \u4e0d\u51b3\u5b9a\u5916\u90e8\u8bbf\u95ee\u65b9\u5f0f\uff0c\u53ea\u662f\u6309 server \u6392\u5217\u987a\u5e8f\u5339\u914d\uff0c\u90fd\u5339\u914d\u4e0d\u4e0a\u5219\u5c55\u793a\u6700\u540e\u4e00\u4e2a\u6216 default server                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270384\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Rysle <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u5e16\u5b50\u56de\u590d\u9700\u8981\u5404\u79cd\u9a8c\u8bc1\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270385\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Rysle <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5e26\u94fe\u63a5\u7684\u4e0d\u8ba9\u56de\uff0c\u81ea\u5df1\u641c\u7d22\u4e00\u4e0b ngx_http_sub_module \u7684\u4f8b\u5b50                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270386\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SenLief <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u5e94\u8be5\u662f\u914d\u7f6e\u9519\u4e86<br \/>location \/jsonrpc {<br \/> proxy_pass http:\/\/localhost:6800;<br \/>}<br \/>\u4e0d\u8981\u5728 proxy_pass \u540e\u8ddf\u76ee\u5f55\uff0c\u4e0d\u52a0 \/\u4f1a\u81ea\u52a8\u66ff\u6362\u8bf7\u6c42\u94fe\u3002\u53ef\u4ee5\u8bd5\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270387\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ihipop <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bf4\u4e86\u8fd9\u4e48\u8bf4\u6ca1\u4e00\u4e2a\u4eba\u8d34\u6587\u6863\u7684\uff0c\u6587\u6863\u91cc\u9762\u8bf4\u7684\u5f88\u6e05<br \/>http:\/\/nginx.org\/en\/docs\/http\/ngx_http_proxy_module.html#proxy_pass<\/p>\n<p>If the\u00a0proxy_pass\u00a0directive is specified with a URI, then when a request is passed to the server, the part of a\u00a0normalized\u00a0request URI matching the location is replaced by a URI specified in the directive:<\/p>\n<p>location \/name\/ { proxy_pass http:\/\/127.0.0.1\/remote\/; }<\/p>\n<p>\u5047\u5982\u4f60\u7684 jupyter \u5de5\u4f5c\u5728 8888 \u7aef\u53e3\u7684 \/ \uff0c\u4e0d\u5b58\u5728\u4efb\u4f55\u91cd\u5b9a\u5411\uff0c\u4e14\u6728\u6709\u7ed1\u5b9a host<br \/>@ashong \u7684\u4f8b\u5b50\u5e94\u8be5\u53ef\u4ee5 work \u7684<br \/>\u4e3b\u4e5f\u6700\u597d\u53c2\u9605\u4e00\u4e0b jupyter \u7684\u65e5\u5fd7\u786e\u5b9a\u95ee\u9898\u800c\u4e0d\u662f\u4e71\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270388\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liuhan907 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6b64\u529f\u80fd\u8fd8\u662f\u5efa\u8bae\u4f7f\u7528 traefik \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270389\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chairuosen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528\u57df\u540d\u5457\u3002\u3002\u3002\u3002\u5185\u7f51\u57df\u540d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270390\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : IvanLi127 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u628a server_name \u8fd9\u884c\u53bb\u6389                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270391\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dorothyREN <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7b54\u6848\u662f\u53ef\u4ee5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270392\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : spolarbear <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             server {<br \/> listen 5000;<br \/> server_name 192.168.0.173;<\/p>\n<p> location \/geoserver {<br \/> proxy_pass http:\/\/localhost:8080;<br \/> #proxy_redirect http:\/\/localhost http:\/\/localhost:8080;<br \/> proxy_set_header Host $host:5000;<br \/> proxy_set_header X-Real-IP $remote_addr;<br \/> proxy_set_header REMOTE-HOST $remote_addr;<br \/> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/> }<br \/>}<\/p>\n<p>\u81ea\u7528\u8fd9\u4e2a\u53ef\u884c\uff0c\u8bbf\u95ee 192.168.0.173:5000\/geoserver \u7684\u8bdd\uff0c\u4f1a\u8f6c\u53d1\u5230 8080 \u7aef\u53e3\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270393\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Judoon <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u636e\u6211\u4e4b\u524d\u4f7f\u7528\uff0cjupyter \u662f\u4e0d\u884c\u7684\uff0c\u524d\u7aef\u52a0\u8f7d\u7684\u6837\u5f0f\u7b49\u9759\u6001\u8d44\u6e90\u94fe\u63a5\u7684\u8def\u5f84\u4e0d\u4f1a\u88ab\u6539\u5199\uff08\u5373\u65e0\u6cd5\u4fee\u6539\u4e3a\u81ea\u5b9a\u4e49\u7684 context path \uff09<\/p>\n<p>\u5982\u679c\u6211\u54ea\u91cc\u6f0f\u770b\u4e86\u6587\u6863\uff0c\u6216\u8005\u4e3b\u641e\u51fa\u6765\u4e86\u53ef\u4ee5\u6559\u6559\u6211<\/p>\n<p>\u9664\u4e86 jupyter\uff0c\u5217\u4e3e\u7684\u5176\u4ed6\u51e0\u4e2a\u76ee\u6d4b\u90fd\u662f\u53ef\u4ee5\u7528 nginx \u5b9e\u73b0\u7684\u3002\u5f53\u7136\uff0c\u6700\u597d\u7684\u65b9\u5f0f\u662f\u57fa\u4e8e\u57df\u540d\uff08 server_name \uff09\u5206\u53d1                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270394\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : nellxzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u611f\u8c22\u5927\u5bb6\u7684\u56de\u590d\uff0c\u73b0\u5728\u6709\u4e86\u4e00\u4e2a\u521d\u6b65\u7684\u65b9\u6848\uff0c\u80fd\u8f6c\u53d1 jupyter\uff0caria2-jsonrpc \u548c aria-ng \u3002<\/p>\n<p>\u914d\u7f6e\u65b9\u6cd5\uff1a<br \/>\u9996\u5148\uff0c [\/etc\/nginx\/nginx.conf] \u4f5c\u5982\u4e0b\u4fee\u6539\uff1a<br \/>&#8220;`<br \/>http {<br \/> &#8230;&#8230;<\/p>\n<p> server {<br \/> listen 4000;<br \/> server_name localhost;<\/p>\n<p> # Jupyter Notebook<br \/> location \/jupyter\/ {<br \/> proxy_pass http:\/\/localhost:8888;<br \/> proxy_set_header Host $host:$server_port;<br \/> proxy_set_header REMOTE-HOST $remote_addr;<br \/> proxy_set_header X-Real-IP $remote_addr;<br \/> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/p>\n<p> # websocket headers<br \/> proxy_http_version 1.1;<br \/> proxy_set_header Upgrade $http_upgrade;<br \/> proxy_set_header Connection &#8216;upgrade&#8217;;<br \/> proxy_set_header X-Scheme $scheme;<\/p>\n<p> proxy_read_timeout 120s;<br \/> proxy_next_upstream error;<br \/> }<\/p>\n<p> # Aria2 JSONRPC<br \/> location \/jsonrpc {<br \/> proxy_pass http:\/\/localhost:6800;<br \/> }<\/p>\n<p> # Aria-NG<br \/> location \/aria-ng\/ {<br \/> proxy_pass http:\/\/localhost:80;<br \/> }<br \/> }<br \/>}<br \/>&#8220;`<\/p>\n<p>\u5176\u6b21\uff0c [~\/.jupyter\/jupyter_notebook_config.py] \u8ffd\u52a0\u5982\u4e0b\u90e8\u5206\uff1a<br \/>&#8220;`<br \/># \u5c06 Jupyter \u7684\u5de5\u4f5c\u8def\u5f84\u6539\u6210 localhost:8888\/jupyter\/<br \/># \u53c2\u8003 https:\/\/segmentfault.com\/a\/1190000016627630<br \/>c.NotebookApp.base_url = &#8216;\/jupyter\/&#8217;<\/p>\n<p># \u5141\u8bb8\u4efb\u4f55\u6e90\u8bbf\u95ee\u670d\u52a1\uff0c\u4fee\u590d\u7528 nginx \u53cd\u5411\u4ee3\u7406\u8bbf\u95ee\u65f6 kernel \u4e0e terminal \u65e0\u6cd5\u52a0\u8f7d\u7684\u95ee\u9898<br \/># \u53c2\u8003 https:\/\/juejin.cn\/post\/6844903877481857037<br \/>c.NotebookApp.allow_origin = &#8216;*&#8217;<br \/>&#8220;`<\/p>\n<p>\u4e00\u4e9b\u8bb0\u5f55\uff1a<br \/>1. \u7aef\u53e3\u4e4b\u6240\u4ee5\u9009 4000\uff0c\u662f\u56e0\u4e3a\u8bbe\u7f6e\u6210 80 \u65f6\u6709\u95ee\u9898\uff0c\u6240\u4ee5\u5c31\u53e6\u627e\u4e86\u4e00\u4e2a\u7a7a\u95f2\u7684\u7aef\u53e3\u3002<br \/>2. location \u548c proxy_pass \u7684\u5199\u6cd5\uff0c\u4e3b\u8981\u53c2\u8003\u4e86\u8fd9\u4e00\u7bc7\uff1a https:\/\/xuexb.github.io\/learn-nginx\/example\/proxy_pass.html \u3002<br \/>3. jupyter \u672c\u6765\u662f\u5de5\u4f5c\u5728 [localhost:8888\/] \u4e0b\u7684\uff0c\u6211\u60f3\u8ba9\u5b83\u5de5\u4f5c\u5728 [localhost:4000\/jupyter\/] \u4e0b\u3002\u5c1d\u8bd5\u4e86 location \u548c proxy_pass \u7684\u5404\u79cd\u5199\u6cd5\uff0c\u4ee5\u53ca rewrite\uff0c\u6ca1\u6210\u529f\u3002\u67d0\u4e9b\u914d\u7f6e\u4e0b\uff0c\u6709\u4e00\u79cd\u5178\u578b\u7684\u73b0\u8c61\u662f\uff0c\u8bbf\u95ee[localhost:4000\/jupyter\/]\u65f6\uff0c\u5730\u5740\u8df3\u8f6c\u5230[localhost:4000\/tree?]\uff08\u5bf9\u5e94\u672c\u4f53\u7684[localhost:8888\/tree?]\uff09\uff0c\u800c\u4e0d\u662f[localhost:4000\/jupyter\/tree?]\uff0c\u4f46\u624b\u52a8\u8f93\u5165\u540e\u8005\uff0c\u4e5f\u6ca1\u6cd5\u6b63\u5e38\u663e\u793a\u3002\u6240\u4ee5\u9000\u800c\u6c42\u5176\u6b21\uff0c\u8ba9 jupyter \u672c\u4f53\u5de5\u4f5c\u5728[localhost:8888\/jupyter\/]\u4e0b\u3002<br \/>4. \u63a5\u4e0b\u6765\u53c8\u51fa\u73b0\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u6253\u5f00 jupyter \u540e\uff0c\u867d\u7136\u6587\u4ef6\u7ba1\u7406\u754c\u9762\u6ca1\u95ee\u9898\uff0c\u4f46\u662f kernel \u548c terminal \u65e0\u6cd5\u52a0\u8f7d\u3002\u6240\u4ee5\u53c8\u52a0\u5165\u4e86\u5141\u8bb8\u6240\u6709\u6e90\u8bbf\u95ee\u670d\u52a1\uff0c\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<p>\u6982\u62ec\u4e00\u4e0b\uff1a<br \/>\u80fd\u591f\u5de5\u4f5c\u5728\u7aef\u53e3\u4e0b\u4e00\u4e2a\u76ee\u5f55\u7684\u670d\u52a1\uff0c\u6bd4\u5982<br \/>&#8211; localhost:8888\/jupyter\/<br \/>&#8211; localhost:6800\/jsonrpc<br \/>&#8211; localhost:80\/aria-ng\/<br \/>\u53ef\u4ee5\u8f6c\u53d1\u3002\u4f46\u662f\u76f4\u63a5\u5de5\u4f5c\u5728\u7aef\u53e3\u4e0b\u7684\u670d\u52a1\uff0c\u6bd4\u5982<br \/>&#8211; localhost:5299\/<br \/>\u6ca1\u5f04\u51fa\u6765\u3002\u6811\u8393\u6d3e\u80fd\u5b89\u88c5\u7684 Nginx \u7248\u672c\u53ea\u6709 1.14.2\uff0c\u4e0d\u77e5\u9053\u8ddf\u7248\u672c\u6709\u6ca1\u6709\u5173\u7cfb\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270395\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : nellxzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Judoon jupyter \u53ef\u4ee5\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5270396\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : rekulas <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8def\u5f84\u8f6c\u53d1\u5e76\u4e0d\u603b\u662f\u53ef\u884c\uff0c\u56e0\u4e3a\u88ab\u8f6c\u53d1\u7684\u7a0b\u5e8f\u4e5f\u5fc5\u987b\u652f\u6301\u8ddf\u4f60\u5b9a\u4e49\u7684\u6839\u8def\u5f84\u4e00\u6837\u624d\u53ef\u4ee5\uff0c\u6211\u89c9\u5f97\u66f4\u5b8c\u7f8e\u7684\u65b9\u6848\u662f\u57df\u540d\u63a7\u5236\uff0c\u5373\u4f7f\u4e00\u4e2a\u7aef\u53e3\u4e5f\u53ef\u4ee5\u8f6c\u53d1\u4efb\u610f\u591a\u4e2a\u670d\u52a1(\u6ca1\u6709\u7528\u82b1\u751f\u58f3\u6240\u4ee5\u4e0d\u592a\u6e05\u695a\u80fd\u4e0d\u80fd\u652f\u6301\u57df\u540d)<br \/>\u6211\u548c\u6211\u7684\u670b\u53cb\u4ece\u4e0d\u4f1a\u6709\u8fd9\u4e9b\u95ee\u9898\uff0c\u56e0\u4e3a\u662f\u516c\u7f51 IP\uff0c\u60f3\u5f00\u54ea\u4e2a\u7aef\u53e3\u5f00\u54ea\u4e2a\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Nginx \u80fd\u5426\u5c06\u672c\u5730\u7684\u591a\u4e2a\u7aef\u53e3\u8f6c&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\/341222"}],"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=341222"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/341222\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=341222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=341222"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=341222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}