Closed onlyJinx closed 6 months ago
新版docker镜像内,自带nginx;反代了8787 和3131;所以故意不写的。 报错截图发上来,帮你看看。
iyuu安装
docker run -d \
-v/etc/docker/iyuu_dev/iyuu:/iyuu \
-v /etc/docker/iyuu_dev/data:/data \
-p 8788:8780 \
--name IYUUDev \
--restart=always \
iyuucn/iyuuplus-dev:latest
nginx反代配置
# iyuuDev 服务器转发
server {
listen 443 ssl;
server_name iyuudev.xxx.top;
ssl_certificate /root/.acme.sh/*.xxx.top_ecc/fullchain.cer;
ssl_certificate_key /root/.acme.sh/*.xxx.top_ecc/*.xxx.top.key;
location ^~ / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Connection "";
if (!-f $request_filename){
proxy_pass http://127.0.0.1:8788;
}
}
location /app/d9422b72cffad23098ad301eea0f8419
{
proxy_pass http://127.0.0.1:3131;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
error_page 497 https://$host:$server_port$uri;
}
大佬,这里有一个疑问, 如果不把3131从docker里映射出来的话, 那我nginx接收到 /app/d9422b72cffad23098ad301eea0f8419
这个path的流量之后会转发给本地127.0.0.1:3131, 但是因为docker没有将3131映射出来,所以127.0.0.1:3131是无人监听的呀, 所以根本就不可能连的上吧
docker run -d \ -v /etc/docker/iyuu_dev/iyuu:/iyuu \ -v /etc/docker/iyuu_dev/data:/data \ -p 8788:8780 \ --name IYUUDev \ --restart=always \ iyuucn/iyuuplus-dev:latest
这个命令,容器绑定的是8780端口。 8780端口是我们为了降低使用难度,容器内的nginx监听的端口,已经反向代理了8787 3131;所以,你不需要再套一层转发。
仓库源码:docker/files/etc/nginx/nginx.conf
49行-94行
啊,我以为readme里面的反代配置是可以直接抄的, 原来docker内置了nginx了, 不过现在有一个问题就是, 我本地机器上本身就有一个nginx的, 用来给各个http服务做反代, https由本地的nginx处理, 然后我按照一般的web服务反代iyuudev发现一直连不上长链接, 想问下应该怎么处理, 我之前都是可以正常反代旧版的iyuu的
# iyuu 服务器转发
server {
listen 443 ssl;
#listen 8443 ssl;
server_name iyuu.xxx.top;
ssl_certificate /root/.acme.sh/*.xxx.top_ecc/fullchain.cer;
ssl_certificate_key /root/.acme.sh/*.xxx.top_ecc/*.xxx.top.key;
location / {
proxy_pass http://127.0.0.1:8787;
proxy_redirect off;
# 非443端口的话,需要加上:$server_port
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 497 https://$host:$server_port$uri;
}
# iyuuDev 服务器转发
server {
listen 443 ssl;
server_name iyuudev.xxx.top;
ssl_certificate /root/.acme.sh/*.xxx.top_ecc/fullchain.cer;
ssl_certificate_key /root/.acme.sh/*.xxx.top_ecc/*.xxx.top.key;
location / {
proxy_pass http://127.0.0.1:8788;
proxy_redirect off;
# 非443端口的话,需要加上:$server_port
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 497 https://$host:$server_port$uri;
}
啊,我以为readme里面的反代配置是可以直接抄的, 原来docker内置了nginx了, 不过现在有一个问题就是, 我本地机器上本身就有一个nginx的, 用来给各个http服务做反代, https由本地的nginx处理, 然后我按照一般的web服务反代iyuudev发现一直连不上长链接, 想问下应该怎么处理, 我之前都是可以正常反代旧版的iyuu的
# iyuu 服务器转发 server { listen 443 ssl; #listen 8443 ssl; server_name iyuu.xxx.top; ssl_certificate /root/.acme.sh/*.xxx.top_ecc/fullchain.cer; ssl_certificate_key /root/.acme.sh/*.xxx.top_ecc/*.xxx.top.key; location / { proxy_pass http://127.0.0.1:8787; proxy_redirect off; # 非443端口的话,需要加上:$server_port proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 497 https://$host:$server_port$uri; } # iyuuDev 服务器转发 server { listen 443 ssl; server_name iyuudev.xxx.top; ssl_certificate /root/.acme.sh/*.xxx.top_ecc/fullchain.cer; ssl_certificate_key /root/.acme.sh/*.xxx.top_ecc/*.xxx.top.key; location / { proxy_pass http://127.0.0.1:8788; proxy_redirect off; # 非443端口的话,需要加上:$server_port proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 497 https://$host:$server_port$uri; }
Nginx Proxy Manager高级设置里直接留空就行了,不用配置
Nginx Proxy Manager高级设置里直接留空就行了,不用配置
我是直接使用官方的nginx的, 配置文件就是上面发的, 没有使用 Nginx Proxy Manager
location ^~ / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Connection "";
if (!-f $request_filename){
proxy_pass http://127.0.0.1:8780;
}
}
location /app/d9422b72cffad23098ad301eea0f8419
{
proxy_pass http://127.0.0.1:8780;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
刚按照文档使用nginx反代, 一直提示长链接连不上,后来发现是3131没有映射出来....