Closed sochanged closed 1 year ago
nginx配置文件nginx.conf如下(我的静态页面实际存放位置为:“/var/www/html”):
`user root;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/.conf;
events {
worker_connections 1024;
}
http {
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
map $http_x_forwarded_for $clientRealIp {
"" $remote_addr;
~^(?P
sites-available中的default配置如下:
` map $http_upgrade $connection_upgrade { default upgrade; '' close; }
server { listen 80 default_server; listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm;
server_name _;
location /.well-known/acme-challenge {
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
proxy_pass http://127.0.0.1:9180;
}
}
server { listen 443 ssl http2; listen [::]:443 ssl http2; servername ;
index index.html index.htm;
ssl_certificate /etc/ssl/cert/cert.crt;
ssl_certificate_key /etc/ssl/cert/cert.key;
location /.well-known/acme-challenge {
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
proxy_pass http://127.0.0.1:9180;
}
# #Vmess
location /5d51ec47-5e94-4b78-fd2a-50446548e713 {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
client_max_body_size 1000m;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:2087/;
}
# #Vless
location /6d0d39b4-b3e5-466e-8ed5-696f47a5f8a6 {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
client_max_body_size 1000m;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:2083/;
}
## Trojan
location /eqJWsRJCuw {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
client_max_body_size 1000m;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:2096/;
}
}`
Xray配置文件“/usr/local/xray-ui/bin/config.json”如下:
` {
"log": null, "routing": { "domainStrategy": "IPIfNonMatch", "rules": [ { "inboundTag": [ "api" ], "outboundTag": "api", "type": "field" }, { "type": "field", "domain": [ "www.gstatic.com" ], "outboundTag": "direct" }, { "type": "field", "domain": [ "geosite:category-ads-all", "geosite:cn", "geosite:geolocation-cn" ], "outboundTag": "blocked" }, { "type": "field", "ip": [ "geoip:cn" ], "outboundTag": "blocked" } ] }, "dns": null, "inbounds": [ { "listen": "127.0.0.1", "port": 62789, "protocol": "dokodemo-door", "settings": { "address": "127.0.0.1" }, "streamSettings": null, "tag": "api", "sniffing": null }, { "listen": null, "port": 2087, "protocol": "vmess", "settings": { "clients": [ { "id": "5d51ec47-5e94-4b78-fd2a-50446548e713", "alterId": 0 } ], "disableInsecureEncryption": false }, "streamSettings": { "network": "ws", "security": "none", "wsSettings": { "path": "/5d51ec47-5e94-4b78-fd2a-50446548e713", "headers": {} }, "sockopt": { "tcpFastOpen": false, "domainStrategy": "AsIs", "tcpcongestion": "bbr", "acceptProxyProtocol": false, "tcpKeepAliveIdle": 0, "tcpKeepAliveInterval": 0, "interface": "" } }, "tag": "inbound-2087", "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] } }, { "listen": null, "port": 2083, "protocol": "vless", "settings": { "clients": [ { "id": "6d0d39b4-b3e5-466e-8ed5-696f47a5f8a6", "flow": "" } ], "decryption": "none", "fallbacks": [] }, "streamSettings": { "network": "ws", "security": "none", "wsSettings": { "path": "/6d0d39b4-b3e5-466e-8ed5-696f47a5f8a6", "headers": {} }, "sockopt": { "tcpFastOpen": false, "domainStrategy": "AsIs", "tcpcongestion": "bbr", "acceptProxyProtocol": false, "tcpKeepAliveIdle": 0, "tcpKeepAliveInterval": 0, "interface": "" } }, "tag": "inbound-2083", "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] } }, { "listen": null, "port": 2096, "protocol": "trojan", "settings": { "clients": [ { "password": "eqJWsRJCuw" } ], "fallbacks": [] }, "streamSettings": { "network": "ws", "security": "none", "wsSettings": { "path": "/eqJWsRJCuw", "headers": {} }, "sockopt": { "tcpFastOpen": false, "domainStrategy": "AsIs", "tcpcongestion": "bbr", "acceptProxyProtocol": false, "tcpKeepAliveIdle": 0, "tcpKeepAliveInterval": 0, "interface": "" } }, "tag": "inbound-2096", "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] } } ], "outbounds": [ { "protocol": "freedom", "settings": {} }, { "protocol": "blackhole", "settings": { "response": { "type": "http" } }, "tag": "blocked" } ], "transport": null, "policy": { "system": { "statsInboundDownlink": true, "statsInboundUplink": true }, "levels": { "0": { "handshake": 2, "connIdle": 120, "uplinkOnly": 1, "downlinkOnly": 1 } } }, "api": { "services": [ "HandlerService", "LoggerService", "StatsService" ], "tag": "api" }, "stats": {}, "reverse": null, "fakeDns": null } ` 实在是不好意思,请原谅我太菜了,这个代码框我就是弄不好……我已经非常尽力了,上面这些就是我这一个礼拜自己瞎鼓捣的结果,一个礼拜之前,我从来没用过没有UI界面的工具软件……万望海涵!给您添麻烦了!
配置到子目录的话可以参考这个
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name <your_server_name>;
ssl_certificate /path/to/ssl_certificate;
ssl_certificate_key /path/to/ssl_certificate_key;
location /nginx-ui/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_pass http://127.0.0.1:<listen_port>/;
}
}
如果你也是这样写的,试试 reload一下 nginx。
创建了新站点之后要点启用才行,不然就会显示默认的页面
噢,你 nginx.conf 没有include sites-enabled/*.conf 所以 UI 添加的东西都没有生效
总的来说,你不应该把所有站点的配置文件放在 nginx.conf 中。相关配置的细节建议您先配置 Nginx UI 中的 ChatGPT Token,然后使用在线助手解答您在配置上的问题。按照我说的改完应该就可以了,这并没有涉及到 Nginx UI 设计上的问题,我就先关掉这个 issue 了。
如果后面还是无法正常使用,建议您先还原配置,然后在 nginx.conf 中 include sites-enabled/*.conf,reload nginx,之后先不使用 cf 加速,逐步调试检查问题。
1、使用过程中遇到这样的问题: 这是在错误日志中显示出来的报错,伴随面板上体现的错误是当点击“配置管理”标签时,无法打开页面,顶部报错内容为:Cannot read properties of undefined (reading 'status') ,读取标志持续转动(请见下面截图)。
我设置了将 "http://域名:端口号码/" 跳转为”http://域名/nginx-ui/“ 不知道跟这有么有关系…… 因为配置改动的地方比较多,我已经不确定是在哪一段配置之后出现的这个问题……因为我技术很菜,请谅解!
错误屏幕截图:
系统信息:
麻烦大佬给看看可能是什么原因造成的~
2、另外有个建议,能否在偏好设置中加入“HTTP 监听端口“的设置选项(就像HTTP Challenge 监听端口那样)?
3、还有一个使用中的疑问,就是我不管怎么设置用nginx-ui代理本地服务器上本地的静态网页,都无法正常打开(另外来说,其他协议的节点又都可以正常工作),取而代之的是永远指向nginx的默认页面如下图: 不知大佬有没有时间给科普一下在您的nginx-ui面板中在哪个模块中、怎么设置这静态页面。