gpt4 book ai didi

NGINX 反向代理内容无法正确显示

转载 作者:行者123 更新时间:2023-12-03 03:10:34 29 4
gpt4 key购买 nike

我正在尝试使用 NGINX 来反向代理各种内部应用程序/站点/服务,并且已经能够让某些应用程序/站点/服务正常工作,而另一些则无法工作。

例如,我在下面添加一些代码。第一个鳄梨酱反向代理工作没有任何问题。

Muximux 的第二个反向代理显示的内容没有正确的格式。不知道为什么?

第三个设置给出 404/未找到错误。

#################################################
################### 10.10.1.2 ###################
#################################################

server {
listen 80;
# listen 80 default_server;
# listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name 10.10.1.2;


location / {
try_files $uri $uri/ =404;
}

location /guac {
proxy_pass http://10.10.1.3:8080/guacamole;
proxy_buffering off;
access_log off;
tcp_nodelay on;
tcp_nopush off;
sendfile on;
client_body_buffer_size 10K;
#client_header_buffer_size 1k;
client_max_body_size 8m;
#large_client_header_buffers 2 1k;
client_body_timeout 12;
#client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}


location /muximux {
proxy_pass http://10.10.1.10/mux/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

location /localserve {
proxy_pass http://10.10.1.10;
}

}

任何有关可能出现问题的帮助和指导将不胜感激。

谢谢

最佳答案

通过将多个应用程序放置在单独的子文件夹中,可以实现对单个服务器 block 中的多个应用程序的反向代理。

但是,每个应用程序都必须知道它托管在子文件夹中。

应用程序返回的页面包含指向资源文件和页面链接的 URL。通常,这些 URL(由应用程序创建)还必须以子文件夹为前缀,否则它们将无法正确通过反向代理并导致显示的页面格式不正确。

某些应用程序并非设计为在子文件夹中运行,而其他应用程序则需要很少的调整或不需要调整。您需要调查每个应用程序的配置并查找配置项来设置基本 URL。

关于NGINX 反向代理内容无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39302917/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com