mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-04-26 01:05:52 +03:00
[GH-ISSUE #972] 如何增加nginx模块 #7639
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#7639
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 @chung1912 on GitHub (Apr 18, 2025).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/972
对于需要编译增加nginx插件的情形,比如增加
ngx_http_proxy_connect_module这样的nginx模块,要如何结合nginx-ui来使用?nginx-ui和nginx内核是一体的,怎么让自己编译的又自定义插件的nginx进去呢?
@0xJacky commented on GitHub (Apr 18, 2025):
您可以创建 Dockerfile 尝构建自己的 nginx,并使用脚本安装 nginx-ui。
@chung1912 commented on GitHub (Apr 18, 2025):
我需要用docker容器运行nginx-ui,是不是把本项目中的dockerfile文件里面的uozi/nginx-ui-base:latest,直接替换为我自己构建的nginx,然后制作 nginx-ui镜像?
@freshgeek commented on GitHub (Apr 19, 2025):
感觉是这里 ,https://github.com/0xJacky/uozi-docker/blob/main/nginx-ui-base/Dockerfile ,还挺复杂的,可以一起交流下 我也要自定义自己的模块镜像
@freshgeek commented on GitHub (Apr 21, 2025):
研究了两天,发现坑坑不一样,同步一下发现还挺多人想这么做
先说下流程,需要了解的事情:
详细步骤
打包nginx 基础镜像并且需要deb的基础镜像,教程看这边 https://github.com/nginx/docker-nginx/blob/master/modules/README.md 编译自定义模块教程 ,自有和三方都描述了具体步骤,至于docker-compose的用法就不再描述了
然后就是使用jacky的 https://github.com/0xJacky/uozi-docker/blob/main/nginx-ui-base/Dockerfile ,然后修改为上一步打包出来的镜像, 需要在根目录执行 : docker build -f nginx-ui-base/Dockerfile -t nginx-ui-base .
这时打包好了nginx-ui-base, clone nginx-ui 项目 将Dockerfile文件中的from改成使用第2步带nginx模块的基础镜像
打包:先编译前端,使用node21+ 、pnpm install && pnpm build ;
然后编译后端 需要go 1.23+ go generate
go build -tags=jsoniter -ldflags "$LD_FLAGS -X 'github.com/0xJacky/Nginx-UI/settings.buildTime=$(date +%s)'" -o nginx-ui -v main.go
然后还有一步,因为前面打包后端是输出到根目录的
-o nginx-uidockerfile 是兼容 github流水线 https://github.com/0xJacky/nginx-ui/blob/dev/.github/workflows/build.yml ,所以这里可以直接将Dockerfile中COPY nginx-ui-$TARGETOS-$TARGETARCH$TARGETVARIANT/nginx-ui /usr/local/bin/nginx-ui
改为
COPY nginx-ui /usr/local/bin/nginx-ui
然后开始打包nginx-ui镜像即可输出最终的 带自定义模块的nginx-ui ,再提一嘴,打包好的模块默认是没有加载的,需要再nginx.conf 首行手动load模块 类似这样
load_module "modules/ngx_http_image_filter_module.so";
模块都在/etc/nginx/modules 下面,直接用不带debug的就行
@chung1912 commented on GitHub (Apr 21, 2025):
这个好复杂,如果要更新的话还挺费劲的。后续会出独立ui版,和nginx分开部署,这样的话就方便多了,ui部署的时候环境变量里面直接指定外部nginx,这样就方便多了
@dmiales commented on GitHub (Apr 29, 2025):
@chung1912
Do I understand correctly that it will be possible to launch a docker container with NGINX and separately launch a docker container with NGINX-UI, where I will specify the path to the first container with NGINX?
@0xJacky commented on GitHub (Apr 29, 2025):
Hi @dmiales, this feature will be released in the next rc version.
@luisyoroslav commented on GitHub (May 7, 2025):
Hi @0xJacky, When do you think this change will be available?
@0xJacky commented on GitHub (May 7, 2025):
This feature is already available, refer to https://nginxui.com/guide/config-nginx.html#container-control for more details.
@luisyoroslav commented on GitHub (May 7, 2025):
Nice, thanks!