Nginx的,Deluge,改变端口默认和使用子域

我有这个example.com域。
我使用Nginx安装Wordpress,在example.com
我安装了Deluge,Deluge WebUI,默认端口是8112,而example.com:8112对Deluge Web UI也是一样。
我没有在Deluge上为Nginx安装Python,Deluge有它自己的Web服务器(我想)。
不过, 我想能够使用从subdomain.example.com Deluge WebUI,而不是( example.com:8112subdomain.example.com:8112 )。
如果另一个解决scheme能够继续工作,我也不会太在意,但是对于我来说真正重要的是在subdomain.example.com提供一个可用的Deluge Web UI
默认情况下,即使Nginx停止, subdomain.example.com:8112example.com:8112正常工作,并将其redirect到Deluge WebUI。
然而,我无法用默认端口(80/443)代理Nginx,在8112收听。
我尝试了很多Nginx的解决scheme,甚至设法redirect到Deluge网页,但是我看到的只是一个空白页面(尽pipe使用开发工具检查它,我发现里面有大量的代码,里面的url /somewhere/something.css也在工作)。 这甚至不是一个权限的问题,因为(在做一个备份副本,以正确地恢复他们),我甚至试图给-R 777在洪水的Web目录。 前面的空白页实际上有一些JavaScript错误,可能是阻塞,但他们工作在端口8112,所以也许是一些JavaScript不redirect到正确的端口?
这是我试过的Nginxconfiguration之一。 我尝试了很多,我无法列出所有可能的尝试。
server { listen 80; server_name subdomain.example.com ; ## redirect http to https ## rewrite ^ https://$server_name$request_uri? permanent; } server { listen 443; server_name subdomain.example.com ; root /usr/share/pyshared/deluge/ui/web; index index.html; location / { proxy_pass httTHIS IS INSIDE A CODE WTH ps://localhost:8112; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_header Set-Cookie; proxy_pass_header P3P; } location = /favicon.ico { log_not_found off; access_log off; } location ~* .(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } access_log /var/log/nginx/nginx. example.com .access.log; error_log /var/log/nginx/nginx. example.com .error.log; }
大胆的是我编辑服务器的具体信息

似乎我已经能够使其工作,遵循以下步骤:

安装软件包: deluge deluge-webui deluged

然后开始deluge-web

# deluge-web# deluge-web --fork让它在后台运行

然后像这样设置NGinx

 server { listen 80; server_name subdomain.example.com; location / { proxy_pass http://192.168.0.47:8112; # IP Address of your Server } } 

对于https(端口443),首先我已经设置deluge使用https:

  • 我已经按照这里的说明创build了自签名证书(第一步到第四步)
  • 然后, 在这之后 ,我复制了$HOME/.config/deluge/ssl server.crtserver.key
  • 打开$HOME/.config/web.conf并像这样设置:

     "pkey": "ssl/server.key", "cert": "ssl/server.crt", "https": true, 
  • 然后重新启动deluge-web

  • 最后设置NGinx

     server { listen 443; server_name subdomain.example.com; ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; location / { proxy_pass https://192.168.0.47:8112; # IP Address of your Server } } 

请注意,你似乎不能用httphttps使用deluge :你必须select一个或另一个。