内网部署的明道云,用 nginx 进行反向代理,服务器 IP 为 192.168.0.197
,内网通过 8880 端口访问,外网是通过路由器(内网 IP 192.168.0.1
)进行端口转发,把 外网域名的 8880 端口转发到 192.168.0.197:8880
,/data/mingdao/script/docker-compose.ymal
和 nginx.conf
要怎么写地址参数。
version: '3'
services:
app:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-community:5.8.1
environment: &app-environment
ENV_ADDRESS_MAIN: "http://XXXXX.com"
ENV_APP_VERSION: "5.8.1"
ENV_API_TOKEN: "Ncmul5VN5gHvE**************yJy2o1oZUrwpg1orHO"
ENV_TIME_ZONE: "Asia/Shanghai"
ENV_ADDRESS_ALLOWLITST: "http://192.168.0.197:8880"
ports:
- 8880:8880
- 18880:18880
volumes:
- ./volume/data/:/data/
- ../data:/data/mingdao/data
sc:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-sc:3.0.0
environment:
<<: *app-environment
volumes:
- ./volume/data/:/data/
command:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-command:node1018-python36
environment:
<<: *app-environment
doc:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc:1.2.0
environment:
ENV_FILE_INNER_URI: "app:8880"
upstream hap {
server 192.168.0.197:8880; # 修改为你的 HAP 系统内网IP与端口
}
server {
listen 80;
server_name XXXXX.com;
# access_log /data/logs/weblogs/hap.domain.com.log main; # 日志路径可自定义
#error_log /data/logs/weblogs/hap.domain.com.error.log; # 日志路径可自定义
underscores_in_headers on;
# 上传文件大小限制
client_max_body_size 2048m;
# 开启浏览器压缩,加速请求
gzip on;
gzip_proxied any;
gzip_disable "msie6";
gzip_vary on;
gzip_min_length 512;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/x-javascript application/javascript application/octet-stream text/xml application/xml application/xml+rss text/javascript image/jpeg image/gif image/png;
location / {
set $real_ip '';
if ($http_x_real_ip) {
set $real_ip $http_x_real_ip;
}
if ($http_x_real_ip = '') {
set $real_ip $remote_addr;
}
proxy_set_header X-Real-IP $real_ip;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://hap;
proxy_set_header pdaddr http://192.168.0.197:8880; # 新增,注意修改为你实际的扩展访问地址
}
# IM 需要
location ~ /mds2 {
proxy_set_header Host $http_host;
proxy_hide_header X-Powered-By;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://hap;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header pdaddr http://192.168.0.197:8880; # 新增,注意修改为你实际的扩展访问地址
}
}
这样 192.168.0.197:8880
内网不能显示应用图标,应该是不通。