diff options
Diffstat (limited to 'sysutils/nginx-ui')
| -rw-r--r-- | sysutils/nginx-ui/Makefile | 66 | ||||
| -rw-r--r-- | sysutils/nginx-ui/distinfo | 7 | ||||
| -rw-r--r-- | sysutils/nginx-ui/files/app.ini | 13 | ||||
| -rw-r--r-- | sysutils/nginx-ui/files/nginx-ui.conf | 21 | ||||
| -rw-r--r-- | sysutils/nginx-ui/files/nginx-ui.in | 37 | ||||
| -rw-r--r-- | sysutils/nginx-ui/files/nginx.conf | 37 | ||||
| -rw-r--r-- | sysutils/nginx-ui/files/patch-cmd_version_generate.go | 23 | ||||
| -rw-r--r-- | sysutils/nginx-ui/files/pkg-message.in | 39 | ||||
| -rw-r--r-- | sysutils/nginx-ui/pkg-descr | 11 | ||||
| -rw-r--r-- | sysutils/nginx-ui/pkg-plist | 5 |
10 files changed, 259 insertions, 0 deletions
diff --git a/sysutils/nginx-ui/Makefile b/sysutils/nginx-ui/Makefile new file mode 100644 index 000000000000..8994b5addfe7 --- /dev/null +++ b/sysutils/nginx-ui/Makefile @@ -0,0 +1,66 @@ +PORTNAME= nginx-ui +DISTVERSIONPREFIX= v +DISTVERSION= 2.2.0-patch.1 +PORTREVISION= 1 +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= 372af98307df195a061c650c43505fed42fa279b + +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 + @${MV} ${WRKSRC}/app/dist/dist.tar.xz ${WRKSRC}/app/dist.tar.xz + +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..dcbe6fdcc277 --- /dev/null +++ b/sysutils/nginx-ui/distinfo @@ -0,0 +1,7 @@ +TIMESTAMP = 1760378187 +SHA256 (nginx-ui-v2.2.0-patch.1.frontend.tar.gz) = 5474d9bb984f5bc33e7f34891c67bff237204be4b1a4bc83160d1129b92f6c99 +SIZE (nginx-ui-v2.2.0-patch.1.frontend.tar.gz) = 4225828 +SHA256 (nginx-ui-v2.2.0-patch.1.vendor.tar.gz) = 3aacb1826b7a19049a81915af0b26bf1f1be055189d2d98cabaed6efc34817da +SIZE (nginx-ui-v2.2.0-patch.1.vendor.tar.gz) = 26954893 +SHA256 (0xJacky-nginx-ui-v2.2.0-patch.1_GH0.tar.gz) = cac18ee1ccb0c2afd4084bbe0170eb943de2bd6ff9c676a7d208d3c3190003a7 +SIZE (0xJacky-nginx-ui-v2.2.0-patch.1_GH0.tar.gz) = 13053926 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..d5e04d9137af --- /dev/null +++ b/sysutils/nginx-ui/files/nginx-ui.in @@ -0,0 +1,37 @@ +#!/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}" +# If, for example, there is a power failure, the UNIX socket file will be left and +# the error "connect: connection refused" will be displayed, so the best thing to +# do is to delete it before starting NGINX UI. +start_precmd="rm -f /var/db/nginx-ui/nginx-ui.sock" +sig_stop="SIGQUIT" + +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/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 |
