diff --git a/README-zh_CN.md b/README-zh_CN.md index 0b4ee6ed..1b9650db 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -1,52 +1,49 @@ +
+ Nginx UI Logo +
+ # Nginx UI -Yet another Nginx Web UI +Yet another Nginx Web UI, developed by [0xJacky](https://jackyu.cn/) and [Hintay](https://blog.kugeek.com/). -Version: 1.2.0 +[![Build and Publish](https://github.com/0xJacky/nginx-ui/actions/workflows/build.yml/badge.svg)](https://github.com/0xJacky/nginx-ui/actions/workflows/build.yml) [For English](README.md) -## 项目特色 - -1. 可在线查看服务器 CPU、内存、load average、磁盘使用率等指标 -2. 可一键申请和自动续签 Let's encrypt 证书 -3. 在线编辑 Nginx 配置文件,编辑器支持 Nginx 配置语法高亮 -4. 使用 Go 和 Vue 开发,发行版本为单个可执行的二进制文件 -5. 支持简体中文和英语 - -## 项目预览 - -### 仪表盘 +[TOC] +## 关于项目 ![](resources/screenshots/dashboard.png) +### 特色 +- 在线查看服务器 CPU、内存、load average、磁盘使用率等指标 +- 一键申请和自动续签 Let's encrypt 证书 +- 在线编辑 Nginx 配置文件,编辑器支持 Nginx 配置语法高亮 +- 使用 Go 和 Vue 开发,发行版本为单个可执行的二进制文件 -### 用户列表 +### 国际化 +- 英语 +- 简体中文 +- 繁体中文 -![](resources/screenshots/user-list.png) +我们欢迎您将项目翻译成任何语言。 -### 域名列表 +### 构建基于 +- [The Go Programming Language](https://go.dev/) +- [Gin Web Framework](https://gin-gonic.com) +- [GORM](http://gorm.io/index.html) +- [Vue 2](https://vuejs.org) +- [vue-gettext](https://github.com/Polyconseil/vue-gettext) -![](resources/screenshots/domain-list.png) +## 快速开始 -### 域名编辑 - -![](resources/screenshots/domain-edit.png) - -### 配置列表 - -![](resources/screenshots/config-list.png) - -### 配置编辑 - -![](resources/screenshots/config-edit.png) - -## 使用前注意 +### 使用前注意 Nginx UI 遵循 Nginx 的标准,创建的网站配置文件位于 Nginx 配置目录(自动检测)下的 `sites-available` 目录, 启用后的网站的配置文件将会创建一份软连接到 `sites-enabled` 目录中。因此,您可能需要提前调整配置文件的组织方式。 ## 安装 + ### 平台支持 Nginx UI 可在以下平台中可用: - Mac OS X 10.10 Yosemite 及之后版本(amd64 / arm64); @@ -58,17 +55,99 @@ Nginx UI 可在以下平台中可用: 您可以在 [latest release](https://github.com/0xJacky/nginx-ui/releases/latest) 中下载最新发行版本 -### Linux 一键安装脚本 +### 使用方法 + +#### 通过手动安装 +- 在前台运行 Nginx UI ```shell -bash <(curl -L -s https://raw.githubusercontent.com/0xJacky/nginx-ui/master/install.sh) +nginx-ui --config app.ini ``` +- 关闭在前台运行的 Nginx UI + - 键盘快捷键 `Ctrl+C` + +- 后台运行 Nginx UI +```shell +nohup ./nginx-ui --config app.ini & +``` +- 关闭在后台运行的 Nginx UI +```shell +jobs +kill %job_id +``` +#### 通过脚本安装 +- 启动 Nginx UI +```shell +systemctl start nginx-ui +``` +- 停止 Nginx UI +```shell +systemctl stop nginx-ui +``` +- 重启 Nginx UI +```shell +systemctl restart nginx-ui +``` + +## 手动构建 +对于一键安装脚本不支持的平台,可以尝试手动构建。 + +### 依赖 +- Make + +- Golang 1.17+ + +- node.js 14+ + + ```shell + npx browserslist@latest --update-db + ``` +### 构建前端 + +请在 `frontend` 目录中执行以下命令。 + +```shell +yarn install +make translations +yarn build +``` + +### 构建后端 + +请先完成前端编译,再回到项目的根目录执行以下命令。 + +```shell +go build -o nginx-ui -v main.go +``` + +### Linux 一键安装脚本 + +**安装或升级** + +```shell +bash <(curl -L -s https://raw.githubusercontent.com/0xJacky/nginx-ui/master/install.sh) @ install +``` + 一键安装脚本默认设置的监听端口为 `9000`,HTTP Challenge 端口默认为 `9180`, -如果出现端口冲突请进入 `/usr/local/etc/nginx-ui/app.ini` 修改,并使用 `systemctl restart nginx-ui` 重启 Nginx UI 服务。 +如果出现端口冲突请进入 `/usr/local/etc/nginx-ui/app.ini` 修改, +并使用 `systemctl restart nginx-ui` 重启 Nginx UI 服务。 -服务启动成功后,在浏览器中访问 `http://:9000/install` 完成后续配置 +服务启动成功后,在浏览器中访问 `http://:9000/install` 完成后续配置。 -### Nginx 反向代理配置示例 +**卸载 Nginx UI 但保留配置和数据库文件** + +```shell +bash <(curl -L -s https://raw.githubusercontent.com/0xJacky/nginx-ui/master/install.sh) @ remove ``` + +### 更多用法 + +````shell +bash <(curl -L -s https://raw.githubusercontent.com/0xJacky/nginx-ui/master/install.sh) @ help +```` + +## Nginx 反向代理配置示例 + +```nginx server { listen 80; listen [::]:80; @@ -99,5 +178,21 @@ server { } ``` -## 关于 -Nginx UI 由 [0xJacky](https://jackyu.cn/) 和 [Hintay](https://blog.kugeek.com/) 开发 +## 贡献 + +贡献使开源社区成为学习、启发和创造的绝佳场所。我们**非常感谢**您所做的任何贡献。 + +如果您有让这个项目变得更强的建议,欢迎 fork 这个仓库并创建一个 Pull Request。 + +您也可以创建一个带有 `enhancement` 的 Issue。最后,不要忘记给我们的项目一键三连点个 Star!再次感谢! + +1. Fork 项目 +2. 创建您的分支 (`git checkout -b feature/AmazingFeature`) +3. 提交您的修改 (`git commit -m 'Add some AmazingFeature'`) +4. 推送到您的分支 (`git push origin feature/AmazingFeature`) +5. 创建一个 Pull Request + +## 开源许可 + +这个项目是在 GNU Affero Public License v3.0 (GPLv3) 许可下提供的,您可以在 [LICENSE](LICENSE) 找到。 +通过使用、分发或对本项目做出贡献,表明您已同意本许可证的条款和条件。 diff --git a/README.md b/README.md index 689e71c2..f5486931 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@
- Nginx UI Logo + Nginx UI Logo
-# Nginx UI +# Nginx UI Yet another Nginx Web UI, developed by [0xJacky](https://jackyu.cn/) and [Hintay](https://blog.kugeek.com/). + [![Build and Publish](https://github.com/0xJacky/nginx-ui/actions/workflows/build.yml/badge.svg)](https://github.com/0xJacky/nginx-ui/actions/workflows/build.yml) [简体中文说明](README-zh_CN.md) @@ -99,21 +100,36 @@ You can visit [latest release](https://github.com/0xJacky/nginx-ui/releases/late ### Usage -**Manually Install** - +#### Manually Install +- Start Nginx UI in foreground ```shell -nginx-ui -config app.ini +nginx-ui --config app.ini ``` +- Kill Nginx UI in foreground + - Keyboard shortcuts `Ctrl+C` -**Installed by script** - +- Start Nginx UI in background +```shell +nohup ./nginx-ui --config app.ini & +``` +- Kill Nginx UI in background +```shell +jobs +kill %job_id +``` +#### Installed by script +- Start Nginx UI ```shell systemctl start nginx-ui ``` - -Once the nginx-ui is running, please visit `http://:/install` -in your browser to complete the follow-up configurations. - +- Stop Nginx UI +```shell +systemctl stop nginx-ui +``` +- Restart Nginx UI +```shell +systemctl restart nginx-ui +``` ## Manual Build On platforms where installation scripts are not supported, they can be built manually. @@ -159,6 +175,9 @@ bash <(curl -L -s https://raw.githubusercontent.com/0xJacky/nginx-ui/master/inst ``` The default listening port is 9000, and the default HTTP Challenge port is 9180. If there is a port conflict, please modify `/usr/local/etc/nginx-ui/app.ini` manually, then use `systemctl restart nginx-ui` to reload the Nginx UI service. +Once the nginx-ui is running, please visit `http://:/install` +in your browser to complete the follow-up configurations. + **Remove Nginx UI, except configuration and database files** ```shell diff --git a/server/tool/cpu_usage.go b/server/tool/cpu_usage.go index 207f8139..3796883d 100644 --- a/server/tool/cpu_usage.go +++ b/server/tool/cpu_usage.go @@ -42,6 +42,5 @@ func RecordCpuUsage() { if len(CpuTotalBuffer) > 200 { CpuTotalBuffer = CpuTotalBuffer[1:] } - // time.Sleep(1 * time.Second) } }