Nginx重定向到node-red Jmeter 板给了我双/uiui/

p4tfgftt  于 2023-10-17  发布在  Nginx
关注(0)|答案(1)|浏览(160)

我想显示我的节点红色 Jmeter 板与duckdns链接。我把这段代码放在Nginx的配置文件中。
但如果我测试我的设置,我得到:
无法GET /uiui/
当我删除/ui时,它会给我正确的/ui链接。但它不是那样的...我怎么知道为什么有一个额外的ui/?如果我输入http://my-ip:my-port/ui/get:Cannot GET /ui/ui/ If i put http://my-ip:my-port/halloui get:无法获取/halloui/
系统:Rock-pi 4 with docker/portainer我有一个Nginx docker,我也安装了Openmediavault.而且我读到Nginx也被OpenMediaVault使用。是因为我运行了两个示例吗?与配置文件有冲突吗?
我怎么能找到问题?
已重新安装Nginx和OpenMediaVault

### Based on alpine defaults
# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.conf?h=3.15-stable
user abc;
# Set number of worker processes automatically based on number of CPU cores.
include /config/nginx/worker_processes.conf;
# Enables the use of JIT for regular expressions to speed-up their processing.
pcre_jit on;
# Configures default error logger.
error_log /config/log/nginx/error.log;
# Includes files with directives to load dynamic modules.
include /etc/nginx/modules/*.conf;
# Include files with config snippets into the root context.
include /etc/nginx/conf.d/*.conf;
events {
    # The maximum number of simultaneous connections that can be opened by
    # a worker process.
    worker_connections 1024;
}
http {
    # Includes mapping of file name extensions to MIME types of responses
    # and defines the default type.
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    # Name servers used to resolve names of upstream servers into addresses.
    # It's also needed when using tcpsocket and udpsocket in Lua modules.
    #resolver 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001;
    include /config/nginx/resolver.conf;
    # Don't tell nginx version to the clients. Default is 'on'.
    server_tokens off;
    # Specifies the maximum accepted body size of a client request, as
    # indicated by the request header Content-Length. If the stated content
    # length is greater than this size, then the client receives the HTTP
    # error code 413. Set to 0 to disable. Default is '1m'.
    client_max_body_size 0;
    # Sendfile copies data between one FD and other from within the kernel,
    # which is more efficient than read() + write(). Default is off.
    sendfile on;
    # Causes nginx to attempt to send its HTTP response head in one packet,
    # instead of using partial frames. Default is 'off'.
    tcp_nopush on;
    # all ssl related config moved to ssl.conf
    # included in server blocks where listen 443 is defined
    # Enable gzipping of responses.
    #gzip on;
    # Set the Vary HTTP header as defined in the RFC 2616. Default is 'off'.
    gzip_vary on;
    # Helper variable for proxying websockets.
    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
    server {
    listen       80;
    server_name  mylink.duckdns.org;
    location / {
    proxy_pass http://myip:1880/ui/ ;
    }
    }
    # Sets the path, format, and configuration for a buffered log write.
    access_log /config/log/nginx/access.log;
    # Includes virtual hosts configs.
    include /etc/nginx/http.d/*.conf;
    include /config/nginx/site-confs/*.conf;
}
daemon off;
pid /run/nginx.pid;
amrnrhlw

amrnrhlw1#

一种可能的解决方案是在Node-RED容器中编辑/data/settings.js中挂载的settings.js
首先将httpAdminRoot更改为类似/editor的内容,这意味着Node-RED编辑器将从http://ip-address:1880/移动到http://ip-address:1880/editor
然后将ui: { path: 'ui' }更改为ui: { path : '/' },这将从 Jmeter 板路径中删除/ui
然后您可以使用:用途:

server {
    listen       80;
    server_name  my-link.duckdns.org;

    location / {
        proxy_pass http://my-ip:my-port/ ;
    }
}

相关问题