【问题标题】:NGINX Reverse Proxy Content Not Displaying ProperlyNGINX 反向代理内容未正确显示
【发布时间】:2016-09-03 03:19:40
【问题描述】:

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

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

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

第三个设置给出 404/not found 错误。

#################################################
################### 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;
    }

}

非常感谢任何关于可能出现问题的帮助和指导。

谢谢

【问题讨论】:

    标签: nginx proxy reverse


    【解决方案1】:

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

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

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

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

    【讨论】:

      猜你喜欢
      • 2015-01-04
      • 2022-11-10
      • 2015-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-03
      • 2021-05-04
      相关资源
      最近更新 更多