二话不说,直接解决方案:
server {
listen 80;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# 关键 保留代理之前的真实客户端ip
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 在多级代理的情况下,记录每次代理之前的客户端真实ip
# proxy_set_header HTTP_X_FORWARDED_FOR $remote_addr;
# 指定修改被代理服务器返回的响应头中的location头域跟refresh头域数值
# proxy_redirect default;
#保留代理之前的host
proxy_set_header Host $host;
proxy_connect_timeout 180;
proxy_read_timeout 180;
proxy_send_timeout 180;
proxy_pass http://localhost:4999;
}
}
解决方案来源:
Docker安装法本地图片上传问题 · Issue #706 · star7th/showdoc https://github.com/star7th/showdoc/issues/706
–>
Docker 部署方式HTTPS图片上传问题 · Issue #573 · star7th/showdoc
https://github.com/star7th/showdoc/issues/573
之前用的解决方案:
修改:\showdoc\server\Application\Api\Controller\PageController.class.php
去掉get_domain().
大概原理:图片上传流程不变,但返回的图片地址变成相对地址,方便转移项目。
缺点:项目导出后图片不显示。
注:截至19.12.01,最新版在line:250/417 可添加变量代替,例:
$my_domain = 'http://doc.xxx.com';