mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-04-25 08:45:58 +03:00
[GH-ISSUE #612] 运行app.int的时候 runtime error: invalid memory address or nil pointer dereference #310
Labels
No labels
Q/A
bug
casdoor
dependencies
docker
documentation
duplicate
enhancement
help wanted
invalid
lego
platform:openwrt
platform:windows
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-ui#310
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @excaliburKongbai on GitHub (Oct 12, 2024).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/612
Describe the bug
使用docker部署
docker run -dit
--name=nginx-ui
--restart=always
-e TZ=Asia/Shanghai
-v /mnt/user/appdata/nginx:/etc/nginx
-v /mnt/user/appdata/nginx-ui:/etc/nginx-ui
-v /home/www/web:/web
-p 8080:80 -p 8443:443
uozi/nginx-ui:latest
在根目/etc/nginx-ui 运行 nginx-ui -config app.ini发生异常空指针
Run Logs
root@6ee3e50328f2:/etc/nginx-ui# nginx-ui -config app.ini
2024/10/12 10:49:34 [overseer] disabled. run failed: listen tcp 0.0.0.0:9000: bind: address already in use
2024-10-12 10:49:34 INFO nginx-ui/main.go:20 Nginx configuration directory: /etc/nginx
2024-10-12 10:49:34 ERROR kernal/boot.go:67 runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
github.com/0xJacky/Nginx-UI/internal/kernal.recovery()
/home/runner/work/nginx-ui/nginx-ui/internal/kernal/boot.go:66 +0x65
panic({0x36ce840?, 0x7594300?})
/opt/hostedtoolcache/go/1.23.2/x64/src/runtime/panic.go:785 +0x132
github.com/0xJacky/Nginx-UI/internal/kernal.RegisterAcmeUser()
/home/runner/work/nginx-ui/nginx-ui/internal/kernal/register_acme_user.go:10 +0x2c
github.com/0xJacky/Nginx-UI/internal/kernal.Boot()
/home/runner/work/nginx-ui/nginx-ui/internal/kernal/boot.go:40 +0xa2
main.Program({0x0, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0, ...}, ...})
/home/runner/work/nginx-ui/nginx-ui/main.go:22 +0xac
github.com/jpillora/overseer.Run({0x0, 0x477f8d0, {0xc0013c2fe0, 0xc}, {0x0, 0x0, 0x0}, {0x0, 0x0}, 0x12a05f200, ...})
/home/runner/go/pkg/mod/github.com/jpillora/overseer@v1.1.6/overseer.go:106 +0x215
main.main()
/home/runner/work/nginx-ui/nginx-ui/main.go:43 +0x2fd
2024-10-12 10:49:34 INFO nginx-ui/main.go:31 Server exited
@0xJacky commented on GitHub (Oct 12, 2024):
您好,docker 启动后会自动运行的,无需进入容器执行启动命令,如果 docker 启动失败,可以贴一下 docker logs -f nginx-ui 的日志,谢谢。
@excaliburKongbai commented on GitHub (Oct 12, 2024):
好的,请问启动docker 后的访问地址是什么吗?直接返回80端口吗
@0xJacky commented on GitHub (Oct 12, 2024):
看你的端口映射情况,我看配置文件是 8080
@excaliburKongbai commented on GitHub (Oct 12, 2024):
我这边打开防火墙,访问8080端口nginx 502了
我修改了app.in的HttpPort的端口防止端口冲突,并且重启了容器还是不行
@excaliburKongbai commented on GitHub (Oct 12, 2024):
16 connect() failed (111: Connection refused) while connecting to upstream, client: 183.30.222.244, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:9000/favicon.ico", host: "47...:8080", referrer: "http://47...*:8080/admin"
我这边查看了一下nginx 的错误日志,我修改了app.in的配置,重启了容器,但是服务没有刷新
@0xJacky commented on GitHub (Oct 12, 2024):
修改了nginx-ui的端口要改 nginx 的配置文件,因为 nginx 反向代理了 nginx-ui,如果不需要,可以直接暴露 nginx-ui 的端口出来。
@YMingPro commented on GitHub (Oct 12, 2024):
在docker desktop的运行方式中,直接用命令运行起容器但缺少-p 9000:9000 的映射似乎访问不了nginx-ui的界面?
@0xJacky commented on GitHub (Oct 12, 2024):
并不是,直接访问80端口就可以访问 nginx-ui 做了反向代理了,如果不能访问,麻烦提供日志 谢谢
@YMingPro commented on GitHub (Oct 12, 2024):
且访问后会初始化时会出现没有app.ini的报错,补充了一个app.ini后,又会提示invalid memory address or nil pointer dereference
所以似乎不支持windows的docker




尝试了下把映射的两个目录去掉后,启动报告依然会出现Error save settings open /etc/nginx-ui/app.ini: no such file or directory的错误
最后:在手动进入容器内的目录新增 touch /etc/nginx-ui/app.ini 空白文件后,重启容器,一切恢复正常。但依旧8080端口映射不了,默认还是9000
@excaliburKongbai commented on GitHub (Oct 12, 2024):
好的我这边已经解决问题了
@excaliburKongbai commented on GitHub (Oct 12, 2024):
这个9000端口不需要对外暴露,1你直接访问映射:80端口的就可以了,如果你修改了nginx-ui的端口,需要修改nginx-ui.conf

@YMingPro commented on GitHub (Oct 12, 2024):
请你看清楚我的截图,1. 我跟着文档,映射的是8080到容器的80,且访问8080无效,9000才可以。且容器内的nginx.conf并没有配置nginx-ui的代理

@excaliburKongbai commented on GitHub (Oct 12, 2024):
1.我建议你看一下nginx的错误日志,
2.他那个反向代理是在/ete/nign/conf.d/里面的
3.你直接吧9000端映射出来也是能用的,相当于就是放弃反向代理
@YMingPro commented on GitHub (Oct 12, 2024):
综上,其实问题我可以解决,在确定容器内的conf.d目录和nginx.conf文件都没反射代理9000端口情况下我可以手动处理,包括之前说的各种问题,我都可以手动处理解决。
但按文档来说理论上这一切应该是顺利的,但在win下处理这个就会出现了问题,看能不能定位或修复吧。
@jflad17 commented on GitHub (Oct 20, 2024):
I'm getting this issue as well on the latest release, not sure why this was closed. I'm running debian 12, well Raspberry Pi OS. It was working fine until I installed nginx. After I installed nginx, nginx-ui didn't work at all, it just returned this error. I will try to troubleshoot via this issue and reading others. Hopefully the translation makes sense.
@0xJacky commented on GitHub (Oct 20, 2024):
Please wait for the next beta version, we might address this issue.
@jflad17 commented on GitHub (Oct 20, 2024):
Wow that was a fast reply, I did figure it out in https://github.com/0xJacky/nginx-ui/issues/131 from your comments. It seems when you change the port it doesn't auto redirect to install.