更新 1

更新 1

NGINX 位置配置:

location /geminabox/ {
  client_body_buffer_size    128K;
  client_max_body_size       16M;

  rewrite ^/geminabox/(.*) /$1 break;
  proxy_set_header Host $http_host/geminabox/;
  proxy_pass http://127.0.0.1:8205/;
}

我正在尝试在 nginx 后面运行 GemInABox。该服务本身运行良好,但在 Web 显示屏上它无法正确传递静态文件,显示空白 html。从控制台来看,错误似乎是它调用了 example.com/master.css,而不是 example.com/geminabox/master.css。但如果我在 Web 浏览器中调用 127.0.0.1:8205,它会正确显示。

NGINX 的错误日志: [error] 5813#0: *272 open() "/usr/share/nginx/html/master.js" failed (2: No such file or directory), client: 123.123.123.10, server: 123.123.123.12, request: "GET /master.js HTTP/1.1", host: "123.123.123.12", referrer: "http://123.123.123.12/geminabox/" (ips 已更改)

我研究了一些建议,比如添加尾部斜杠或添加更多标题选项,但到目前为止这些建议都没有奏效。所以我希望这只是我忽略的一个小而明显的问题。

更新 1

根据要求我的整个 nginx 块

user nobody;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
   tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80;
        listen       [::]:80;
        server_name  137.226.172.42;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

我的位置文件位于 /default.d/

相关内容