diff options
Diffstat (limited to 'sysutils/nginx-ui')
17 files changed, 341 insertions, 0 deletions
diff --git a/sysutils/nginx-ui/Makefile b/sysutils/nginx-ui/Makefile new file mode 100644 index 000000000000..79e7dc153d36 --- /dev/null +++ b/sysutils/nginx-ui/Makefile @@ -0,0 +1,64 @@ +PORTNAME= nginx-ui +DISTVERSIONPREFIX= v +DISTVERSION= 2.1.17 +CATEGORIES= sysutils +MASTER_SITES= LOCAL/dtxdf/${PORTNAME}/ +DISTFILES= ${PORTNAME}-${DISTVERSIONPREFIX}${DISTVERSION}.frontend${EXTRACT_SUFX} \ + ${PORTNAME}-${DISTVERSIONPREFIX}${DISTVERSION}.vendor${EXTRACT_SUFX} + +MAINTAINER= dtxdf@FreeBSD.org +COMMENT= Yet another WebUI for Nginx +WWW= https://nginxui.com + +LICENSE= AGPLv3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go:1.25,modules +USE_GITHUB= yes +GH_ACCOUNT= 0xJacky + +USE_RC_SUBR= ${PORTNAME} + +GO_BUILDFLAGS= -ldflags "\ + -X 'github.com/0xJacky/Nginx-UI/settings.buildTime=${BUILD_DATE}'" \ + -tags=jsoniter + +SUB_FILES= pkg-message +SUB_LIST= USER=${NGINXUI_USER} + +PLIST_SUB= GROUP=${NGINXUI_USER} \ + USER=${NGINXUI_GROUP} + +NGINXUI_USER= root +NGINXUI_GROUP= wheel + +BUILD_DATE= $$(date -u +%s) + +# Run 'git checkout ${DISTVERSIONPREFIX}${DISTVERSION} && git rev-parse HEAD' +# in the NGINX UI repository to get the value of GITID. +GITID= 876213ad12449216d82520b3808b59cdaf0e1276 + +post-extract: + @${MKDIR} ${WRKSRC}/vendor + @cd ${WRKDIR}/${PORTNAME}-vendor && ${COPYTREE_SHARE} . ${WRKSRC}/vendor + @${MKDIR} ${WRKSRC}/app/dist + @cd ${WRKDIR}/${PORTNAME}-frontend && ${COPYTREE_SHARE} . ${WRKSRC}/app/dist + +post-patch: + @${REINPLACE_CMD} -e 's/newLineSymbol/"\\n"/g' \ + ${WRKSRC}/vendor/github.com/imega/luaformatter/formatter/writer.go + @${REINPLACE_CMD} -e 's,%%GITID%%,${GITID},g' ${WRKSRC}/cmd/version/generate.go + @${RM} ${WRKSRC}/vendor/github.com/shirou/gopsutil/v4/internal/common/binary.go + +pre-build: + @${SETENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=off ${GO_CMD} generate ${WRKSRC}/cmd/version/generate.go + +post-install: + @${MKDIR} ${STAGEDIR}/var/db/${PORTNAME} + ${INSTALL_DATA} ${FILESDIR}/app.ini ${STAGEDIR}/var/db/${PORTNAME}/app.ini.sample + @${MKDIR} ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} ${FILESDIR}/nginx-ui.conf ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} ${FILESDIR}/nginx.conf ${STAGEDIR}${DATADIR} + @${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' ${STAGEDIR}${DATADIR}/nginx.conf + +.include <bsd.port.mk> diff --git a/sysutils/nginx-ui/distinfo b/sysutils/nginx-ui/distinfo new file mode 100644 index 000000000000..0bc2e4f53e63 --- /dev/null +++ b/sysutils/nginx-ui/distinfo @@ -0,0 +1,9 @@ +TIMESTAMP = 1756360261 +SHA256 (nginx-ui-v2.1.17.frontend.tar.gz) = 8f93d1d2e69600ce2a0ef56c78f1913914806cc3bf524ca81e1641905ccfb23b +SIZE (nginx-ui-v2.1.17.frontend.tar.gz) = 1694681 +SHA256 (nginx-ui-v2.1.17.vendor.tar.gz) = d5da0ff0503fc8ab7468e48b9c8e5a3cfcdbd248b590bb55e934d8ef319e593b +SIZE (nginx-ui-v2.1.17.vendor.tar.gz) = 24145528 +SHA256 (2758ffc346a65bc99084e20ff3c2dee4b8ce7b58.patch) = a9d512710c21126504a2fc524bbe1f1865255c52faa84b55da4c03e2a510de84 +SIZE (2758ffc346a65bc99084e20ff3c2dee4b8ce7b58.patch) = 21707 +SHA256 (0xJacky-nginx-ui-v2.1.17_GH0.tar.gz) = da00d80d0e8b13b742597021fdb13b260662a87fdbd5b2d71fc37cac75fd3e82 +SIZE (0xJacky-nginx-ui-v2.1.17_GH0.tar.gz) = 12110923 diff --git a/sysutils/nginx-ui/files/app.ini b/sysutils/nginx-ui/files/app.ini new file mode 100644 index 000000000000..8392a58d573e --- /dev/null +++ b/sysutils/nginx-ui/files/app.ini @@ -0,0 +1,13 @@ +[app] +PageSize = 10 + +[server] +Host = 0.0.0.0 +Port = 9000 +RunMode = release + +[cert] +HTTPChallengePort = 9180 + +[terminal] +StartCmd = login diff --git a/sysutils/nginx-ui/files/nginx-ui.conf b/sysutils/nginx-ui/files/nginx-ui.conf new file mode 100644 index 000000000000..ec0d062aa971 --- /dev/null +++ b/sysutils/nginx-ui/files/nginx-ui.conf @@ -0,0 +1,21 @@ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +server { + listen 80; + server_name localhost; # your domain here + client_max_body_size 128M; # maximum upload size + + location / { + 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 $connection_upgrade; + proxy_pass http://127.0.0.1:9000/; + } +} diff --git a/sysutils/nginx-ui/files/nginx-ui.in b/sysutils/nginx-ui/files/nginx-ui.in new file mode 100644 index 000000000000..775365e846d0 --- /dev/null +++ b/sysutils/nginx-ui/files/nginx-ui.in @@ -0,0 +1,32 @@ +#!/bin/sh + +# PROVIDE: nginx_ui +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Configuration settings for NGINX UI in /etc/rc.conf +# +# nginx_ui_enable (bool): Enable NGINX UI. (default=NO) +# nginx_ui_log (str): Log output. (default=/var/log/nginx-ui.log) +# nginx_ui_runas (str): User to run NGINX UI as. (default=%%USER%%) +# + +. /etc/rc.subr + +name="nginx_ui" +desc="Yet another WebUI for Nginx" +rcvar="${name}_enable" + +load_rc_config $name + +: ${nginx_ui_enable:="NO"} +: ${nginx_ui_log:="/var/log/nginx-ui.log"} +: ${nginx_ui_runas:="%%USER%%"} + +nginx_ui_chdir="/var/db/nginx-ui" +pidfile="/var/run/nginx-ui.pid" +procname="%%LOCALBASE%%/bin/nginx-ui" +command="/usr/sbin/daemon" +command_args="-o ${nginx_ui_log} -u ${nginx_ui_runas} -p ${pidfile} -t \"${desc}\" ${procname}" + +run_rc_command "$1" diff --git a/sysutils/nginx-ui/files/nginx.conf b/sysutils/nginx-ui/files/nginx.conf new file mode 100644 index 000000000000..7aca8a6e8f82 --- /dev/null +++ b/sysutils/nginx-ui/files/nginx.conf @@ -0,0 +1,37 @@ +user www; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +error_log /var/log/nginx/error.local.log notice; +pid /var/run/nginx.pid; + +load_module %%PREFIX%%/libexec/nginx/ngx_stream_module.so; + +events { + worker_connections 1024; +} + +stream { + include %%PREFIX%%/etc/nginx/streams-enabled/*; +} + +http { + include %%PREFIX%%/etc/nginx/mime.types; + default_type application/octet-stream; + + 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; + + keepalive_timeout 65; + + gzip on; + + include %%PREFIX%%/etc/nginx/conf.d/*.conf; + include %%PREFIX%%/etc/nginx/sites-enabled/*; +} diff --git a/sysutils/nginx-ui/files/patch-cmd_version_generate.go b/sysutils/nginx-ui/files/patch-cmd_version_generate.go new file mode 100644 index 000000000000..5891b1a46c0f --- /dev/null +++ b/sysutils/nginx-ui/files/patch-cmd_version_generate.go @@ -0,0 +1,23 @@ +--- cmd/version/generate.go.orig 2025-08-28 00:13:15 UTC ++++ cmd/version/generate.go +@@ -8,7 +8,6 @@ import ( + "io" + "io/fs" + "os" +- "os/exec" + "path" + "path/filepath" + "runtime" +@@ -74,11 +73,7 @@ func getGitCommitHash(basePath string) (string, error) + } + + func getGitCommitHash(basePath string) (string, error) { +- cmd := exec.Command("git", "-C", basePath, "rev-parse", "HEAD") +- commitHash, err := cmd.Output() +- if err != nil { +- return "", err +- } ++ commitHash := "%%GITID%%" + + return strings.TrimRight(string(commitHash), "\r\n"), nil + } diff --git a/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd.go b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd.go new file mode 100644 index 000000000000..bfbd8adfc816 --- /dev/null +++ b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd.go @@ -0,0 +1,13 @@ +--- vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd.go.orig 2025-08-28 06:12:56 UTC ++++ vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd.go +@@ -154,9 +154,7 @@ func parsedevstat(buf []byte) (devstat, error) { + func parsedevstat(buf []byte) (devstat, error) { + var ds devstat + br := bytes.NewReader(buf) +- // err := binary.Read(br, binary.LittleEndian, &ds) +- err := common.Read(br, binary.LittleEndian, &ds) +- if err != nil { ++ if err := binary.Read(br, binary.LittleEndian, &ds); err != nil { + return ds, err + } + diff --git a/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__386.go b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__386.go new file mode 100644 index 000000000000..93c140610bef --- /dev/null +++ b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__386.go @@ -0,0 +1,11 @@ +--- vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd_386.go.orig 2025-08-28 06:14:45 UTC ++++ vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd_386.go +@@ -50,7 +50,7 @@ type devstat struct { + Flags uint32 + Device_type uint32 + Priority uint32 +- Id *byte ++ Id [sizeofPtr]byte + Sequence1 uint32 + } + diff --git a/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__amd64.go b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__amd64.go new file mode 100644 index 000000000000..d5881f0968f3 --- /dev/null +++ b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__amd64.go @@ -0,0 +1,11 @@ +--- vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd_amd64.go.orig 2025-08-28 06:15:24 UTC ++++ vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd_amd64.go +@@ -52,7 +52,7 @@ type devstat struct { + Device_type uint32 + Priority uint32 + Pad_cgo_1 [4]byte +- ID *byte ++ ID [sizeofPtr]byte + Sequence1 uint32 + Pad_cgo_2 [4]byte + } diff --git a/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__arm.go b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__arm.go new file mode 100644 index 000000000000..c749c6d093d0 --- /dev/null +++ b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__arm.go @@ -0,0 +1,11 @@ +--- vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd_arm.go.orig 2025-08-28 06:15:52 UTC ++++ vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd_arm.go +@@ -50,7 +50,7 @@ type devstat struct { + Flags uint32 + Device_type uint32 + Priority uint32 +- Id *byte ++ Id [sizeofPtr]byte + Sequence1 uint32 + } + diff --git a/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__arm64.go b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__arm64.go new file mode 100644 index 000000000000..a6d7e0a49541 --- /dev/null +++ b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_disk_disk__freebsd__arm64.go @@ -0,0 +1,11 @@ +--- vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd_arm64.go.orig 2025-08-28 06:16:23 UTC ++++ vendor/github.com/shirou/gopsutil/v4/disk/disk_freebsd_arm64.go +@@ -52,7 +52,7 @@ type devstat struct { + Flags uint32 + Device_type uint32 + Priority uint32 +- Id *byte ++ Id [sizeofPtr]byte + Sequence1 uint32 + Pad_cgo_0 [4]byte + } diff --git a/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_process_process__bsd.go b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_process_process__bsd.go new file mode 100644 index 000000000000..a43bd97cd52c --- /dev/null +++ b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_process_process__bsd.go @@ -0,0 +1,10 @@ +--- vendor/github.com/shirou/gopsutil/v4/process/process_bsd.go.orig 2025-08-28 06:18:32 UTC ++++ vendor/github.com/shirou/gopsutil/v4/process/process_bsd.go +@@ -71,6 +71,6 @@ func parseKinfoProc(buf []byte) (KinfoProc, error) { + func parseKinfoProc(buf []byte) (KinfoProc, error) { + var k KinfoProc + br := bytes.NewReader(buf) +- err := common.Read(br, binary.LittleEndian, &k) ++ err := binary.Read(br, binary.LittleEndian, &k) + return k, err + } diff --git a/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_process_process__freebsd.go b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_process_process__freebsd.go new file mode 100644 index 000000000000..0d8403972089 --- /dev/null +++ b/sysutils/nginx-ui/files/patch-vendor_github.com_shirou_gopsutil_v4_process_process__freebsd.go @@ -0,0 +1,20 @@ +--- vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go.orig 2025-08-28 06:19:32 UTC ++++ vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go +@@ -79,7 +79,7 @@ func (p *Process) CwdWithContext(_ context.Context) (s + + var k kinfoFile + br := bytes.NewReader(buf) +- if err := common.Read(br, binary.LittleEndian, &k); err != nil { ++ if err := binary.Read(br, binary.LittleEndian, &k); err != nil { + return "", err + } + cwd := common.IntToString(k.Path[:]) +@@ -279,7 +279,7 @@ func (p *Process) MemoryInfoWithContext(_ context.Cont + if err != nil { + return nil, err + } +- pageSize := common.LittleEndian.Uint16([]byte(v)) ++ pageSize := binary.LittleEndian.Uint16([]byte(v)) + + return &MemoryInfoStat{ + RSS: uint64(k.Rssize) * uint64(pageSize), diff --git a/sysutils/nginx-ui/files/pkg-message.in b/sysutils/nginx-ui/files/pkg-message.in new file mode 100644 index 000000000000..e847e30b79e5 --- /dev/null +++ b/sysutils/nginx-ui/files/pkg-message.in @@ -0,0 +1,39 @@ +[ +{ type: install + message: <<EOM +NGINX UI is installed + +1) Install a variant of NGINX like www/nginx: + + pkg install -y www/nginx + +2) Populate NGINX directory with the directories + required by NGINX UI: + + mkdir -p %%PREFIX%%/etc/nginx/conf.d + mkdir -p %%PREFIX%%/etc/nginx/streams-enabled + mkdir -p %%PREFIX%%/etc/nginx/sites-enabled + mkdir -p %%PREFIX%%/etc/nginx/sites-available + mkdir -p %%PREFIX%%/etc/nginx/streams-available + +3) Configure NGINX: + + cp %%DATADIR%%/nginx-ui.conf %%PREFIX%%/etc/nginx/conf.d + cp %%DATADIR%%/nginx.conf %%PREFIX%%/etc/nginx/nginx.conf + + Of course, if you have already modified nginx.conf, backup it first. + Then, after copying the new nginx.conf, edit it according to your needs. + +4) Configure NGINX UI in /var/db/nginx-ui/app.ini + +5) Enable NGINX UI with + + sysrc nginx_ui_enable=YES + +6) Start both NGINX and NGINX UI with + + service nginx-ui start + service nginx start +EOM +} +] diff --git a/sysutils/nginx-ui/pkg-descr b/sysutils/nginx-ui/pkg-descr new file mode 100644 index 000000000000..e4ccdd0a2d1b --- /dev/null +++ b/sysutils/nginx-ui/pkg-descr @@ -0,0 +1,11 @@ +Nginx UI is a comprehensive web-based interface designed to simplify +the management and configuration of Nginx single-node and cluster +nodes. It offers real-time server statistics, Nginx performance +monitoring, AI-powered ChatGPT assistance, the code editor that +supports LLM Code Completion, one-click deployment, automatic renewal +of Let's Encrypt certificates, and user-friendly editing tools for +website configurations. Additionally, Nginx UI provides features +such as online access to Nginx logs, automatic testing and reloading +of configuration files, a web terminal, dark mode, and responsive +web design. Built with Go and Vue, Nginx UI ensures a seamless and +efficient experience for managing your Nginx server. diff --git a/sysutils/nginx-ui/pkg-plist b/sysutils/nginx-ui/pkg-plist new file mode 100644 index 000000000000..183baad10e13 --- /dev/null +++ b/sysutils/nginx-ui/pkg-plist @@ -0,0 +1,5 @@ +@dir(%%USER%%,%%GROUP%%,0700) /var/db/nginx-ui +@sample(%%USER%%,%%GROUP%%,0640) /var/db/nginx-ui/app.ini.sample +%%DATADIR%%/nginx-ui.conf +%%DATADIR%%/nginx.conf +bin/nginx-ui |