diff --git a/ct/nginx-ui.sh b/ct/nginx-ui.sh new file mode 100644 index 000000000..50b0dc84c --- /dev/null +++ b/ct/nginx-ui.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://nginxui.com + +APP="Nginx-UI" +var_tags="${var_tags:-webserver;nginx;proxy}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-512}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /usr/local/bin/nginx-ui ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "nginx-ui" "0xJacky/nginx-ui"; then + msg_info "Stopping Service" + systemctl stop nginx-ui + msg_ok "Stopped Service" + + msg_info "Backing up Configuration" + cp /usr/local/etc/nginx-ui/app.ini /tmp/nginx-ui-app.ini.bak + msg_ok "Backed up Configuration" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "nginx-ui" "0xJacky/nginx-ui" "prebuild" "latest" "/opt/nginx-ui" "nginx-ui-linux-64.tar.gz" + + msg_info "Updating Binary" + cp /opt/nginx-ui/nginx-ui /usr/local/bin/nginx-ui + chmod +x /usr/local/bin/nginx-ui + rm -rf /opt/nginx-ui + msg_ok "Updated Binary" + + msg_info "Restoring Configuration" + mv /tmp/nginx-ui-app.ini.bak /usr/local/etc/nginx-ui/app.ini + msg_ok "Restored Configuration" + + msg_info "Starting Service" + systemctl start nginx-ui + msg_ok "Started Service" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9000${CL}" diff --git a/frontend/public/json/nginx-ui.json b/frontend/public/json/nginx-ui.json new file mode 100644 index 000000000..8dac20d7e --- /dev/null +++ b/frontend/public/json/nginx-ui.json @@ -0,0 +1,48 @@ +{ + "name": "Nginx UI", + "slug": "nginx-ui", + "categories": [ + 21 + ], + "date_created": "2026-02-05", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 9000, + "documentation": "https://nginxui.com/guide/", + "website": "https://nginxui.com", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/nginx-ui.webp", + "config_path": "/usr/local/etc/nginx-ui/app.ini", + "description": "Nginx UI is a comprehensive web-based interface designed to simplify the management and configuration of Nginx servers. It provides features like online statistics, ChatGPT-powered config assistant, automatic Let's Encrypt certificates, and config file editing with syntax highlighting.", + "install_methods": [ + { + "type": "default", + "script": "ct/nginx-ui.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 4, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": "admin", + "password": null + }, + "notes": [ + { + "text": "Nginx runs on ports 80/443, Nginx UI management interface on port 9000.", + "type": "info" + }, + { + "text": "SSL certificates can be managed automatically with Let's Encrypt integration.", + "type": "info" + }, + { + "text": "Initial Login data: `cat ~/nginx-ui.creds`", + "type": "info" + } + ] +} diff --git a/install/nginx-ui-install.sh b/install/nginx-ui-install.sh new file mode 100644 index 000000000..17285ca1d --- /dev/null +++ b/install/nginx-ui-install.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://nginxui.com + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y \ + nginx \ + logrotate +msg_ok "Installed Dependencies" + +fetch_and_deploy_gh_release "nginx-ui" "0xJacky/nginx-ui" "prebuild" "latest" "/opt/nginx-ui" "nginx-ui-linux-64.tar.gz" + +msg_info "Installing Nginx UI" +cp /opt/nginx-ui/nginx-ui /usr/local/bin/nginx-ui +chmod +x /usr/local/bin/nginx-ui +rm -rf /opt/nginx-ui +msg_ok "Installed Nginx UI" + +msg_info "Configuring Nginx UI" +mkdir -p /usr/local/etc/nginx-ui +cat </usr/local/etc/nginx-ui/app.ini +[server] +HttpHost = 0.0.0.0 +HttpPort = 9000 +RunMode = release +JwtSecret = $(openssl rand -hex 32) + +[nginx] +AccessLogPath = /var/log/nginx/access.log +ErrorLogPath = /var/log/nginx/error.log +ConfigDir = /etc/nginx +PIDPath = /run/nginx.pid +TestConfigCmd = nginx -t +ReloadCmd = nginx -s reload +RestartCmd = systemctl restart nginx + +[app] +PageSize = 10 + +[cert] +Email = +CADir = +RenewalInterval = 7 +RecursiveNameservers = +EOF +msg_ok "Configured Nginx UI" + +msg_info "Creating Service" +cat </etc/systemd/system/nginx-ui.service +[Unit] +Description=Another WebUI for Nginx +Documentation=https://nginxui.com +After=network.target nginx.service + +[Service] +Type=simple +ExecStart=/usr/local/bin/nginx-ui --config /usr/local/etc/nginx-ui/app.ini +RuntimeDirectory=nginx-ui +WorkingDirectory=/var/run/nginx-ui +Restart=on-failure +TimeoutStopSec=5 +KillMode=mixed + +[Install] +WantedBy=multi-user.target +EOF +systemctl daemon-reload +msg_ok "Created Service" + +msg_info "Creating Initial Admin User" +systemctl start nginx-ui +sleep 3 +systemctl stop nginx-ui +sleep 1 +/usr/local/bin/nginx-ui reset-password --config /usr/local/etc/nginx-ui/app.ini &>/tmp/nginx-ui-reset.log || true +ADMIN_PASS=$(grep -oP 'Password: \K\S+' /tmp/nginx-ui-reset.log || echo "admin") +echo -e "Nginx-UI Credentials\nUsername: admin\nPassword: $ADMIN_PASS" >~/nginx-ui.creds +rm -f /tmp/nginx-ui-reset.log +msg_ok "Created Initial Admin User" + +msg_info "Starting Service" +systemctl enable -q --now nginx-ui +rm -rf /etc/nginx/sites-enabled/default +msg_ok "Started Service" + +motd_ssh +customize +cleanup_lxc