refactor: more user-friendly documents
parent
cab5ff2c78
commit
7deaef920d
@ -0,0 +1,37 @@
|
||||
# Build
|
||||
|
||||
The build guide is intended for developers or advanced users only.
|
||||
Regular users should follow the [quick start](./getting-started) guide.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Make.
|
||||
- Golang version 1.20 or higher.
|
||||
- node.js version 18 or higher.
|
||||
|
||||
You should execute the following command to update browser list database before build project.
|
||||
```shell
|
||||
npx browserslist@latest --update-db
|
||||
```
|
||||
|
||||
## Build Frontend
|
||||
|
||||
Please execute the following command in `frontend` directory.
|
||||
|
||||
```shell
|
||||
yarn install
|
||||
make translations
|
||||
yarn build
|
||||
```
|
||||
|
||||
## Build Backend
|
||||
|
||||
::: warning
|
||||
Before building the backend, the frontend should be built first because the backend will embed the frontend distribution.
|
||||
:::
|
||||
|
||||
Please execute the following command in the project root directory.
|
||||
|
||||
```shell
|
||||
go build -o nginx-ui -v main.go
|
||||
```
|
||||
@ -0,0 +1,114 @@
|
||||
# Install Script
|
||||
|
||||
This shell script currently only supports Linux systems. If you are using another operating system,
|
||||
please refer to the [quick start](./getting-started) guide for manual installation or use Docker.
|
||||
|
||||
## Install or Upgrade
|
||||
|
||||
### `install.sh install`
|
||||
|
||||
Install or Update Nginx UI.
|
||||
|
||||
### Usage
|
||||
|
||||
```shell
|
||||
install.sh install [OPTIONS]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Options | |
|
||||
|-----------------------|-----------------------------------------------------------------------------------------------------------------|
|
||||
| `-l, --local <file>` | Install Nginx UI from a local file (`string`) |
|
||||
| `-p, --proxy <url>` | Download through a proxy server (`string`)<br/>e.g., `-p http://127.0.0.1:8118` or `-p socks5://127.0.0.1:1080` |
|
||||
| `-r, --reverse-proxy` | Download through a reverse proxy server (`string`)<br/>e.g., `-r https://ghproxy.com/` |
|
||||
|
||||
|
||||
### Quick Usage
|
||||
|
||||
```shell
|
||||
bash <(curl -L -s https://raw.githubusercontent.com/0xJacky/nginx-ui/master/install.sh) install
|
||||
```
|
||||
|
||||
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 restart the Nginx UI service.
|
||||
For more information, please check [reference for config](./config-server).
|
||||
|
||||
|
||||
## Remove
|
||||
|
||||
### `install.sh remove`
|
||||
|
||||
Remove Nginx UI.
|
||||
|
||||
### Usage
|
||||
|
||||
```shell
|
||||
install.sh remove [OPTIONS]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Options | |
|
||||
|-----------|-----------------------------------------------------------------------|
|
||||
| `--purge` | Remove all the Nginx UI files, include logs, configs, etc (`boolean`) |
|
||||
|
||||
### Quick Usage
|
||||
|
||||
::: code-group
|
||||
|
||||
```shell [Remove]
|
||||
# Remove Nginx UI, except configuration and database files
|
||||
bash <(curl -L -s https://raw.githubusercontent.com/0xJacky/nginx-ui/master/install.sh) remove
|
||||
```
|
||||
|
||||
```shell [Purge]
|
||||
# Remove all the Nginx UI file, include configuration and database files
|
||||
bash <(curl -L -s https://raw.githubusercontent.com/0xJacky/nginx-ui/master/install.sh) remove --purge
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## Help
|
||||
|
||||
### `install.sh help`
|
||||
|
||||
Display available options.
|
||||
|
||||
### Usage
|
||||
|
||||
```shell
|
||||
install.sh help
|
||||
```
|
||||
|
||||
### Quick Usage
|
||||
|
||||
```shell
|
||||
bash <(curl -L -s https://raw.githubusercontent.com/0xJacky/nginx-ui/master/install.sh) help
|
||||
```
|
||||
|
||||
## Control Service
|
||||
|
||||
By this script, the Nginx UI will be installed as `nginx-ui` service in systemd.
|
||||
Please use the follow `systemctl` command to control it.
|
||||
|
||||
::: code-group
|
||||
|
||||
```shell [Start]
|
||||
systemctl start nginx-ui
|
||||
```
|
||||
|
||||
```shell [Stop]
|
||||
systemctl stop nginx-ui
|
||||
```
|
||||
|
||||
```shell [Restart]
|
||||
systemctl restart nginx-ui
|
||||
```
|
||||
|
||||
```shell [Show Status]
|
||||
systemctl status nginx-ui
|
||||
```
|
||||
|
||||
:::
|
||||
@ -0,0 +1,87 @@
|
||||
# Project Structure
|
||||
|
||||
## Root
|
||||
|
||||
```
|
||||
.
|
||||
├─ docs # documentations
|
||||
├─ cmd # command-line tool
|
||||
├─ frontend # frontend build with vue 3
|
||||
├─ server # backend build with golang
|
||||
├─ resources # additional resources, not for build
|
||||
├─ template # templates for nginx
|
||||
├─ app.example.ini # example configuration file
|
||||
├─ main.go # entry point for server
|
||||
└─ ...
|
||||
```
|
||||
|
||||
## Documentations
|
||||
|
||||
```
|
||||
.
|
||||
├─ docs
|
||||
│ ├─ .vitepress # configurations directory
|
||||
│ │ ├─ config
|
||||
│ │ └─ theme
|
||||
│ ├─ public # resources
|
||||
│ ├─ [language code] # translations, e.g. zh_CN, zh_TW
|
||||
│ ├─ guide
|
||||
│ │ └─ *.md # guide markdown files
|
||||
│ └─ index.md # index markdown
|
||||
└─ ...
|
||||
```
|
||||
|
||||
## Frontend
|
||||
|
||||
```
|
||||
.
|
||||
├─ frontend
|
||||
│ ├─ public # public resources
|
||||
│ ├─ src # source code
|
||||
│ │ ├─ api # api to backend
|
||||
│ │ ├─ assets # public assets
|
||||
│ │ ├─ components # vue components
|
||||
│ │ ├─ language # translations, use vue3-gettext
|
||||
│ │ ├─ layouts # vue layouts
|
||||
│ │ ├─ lib # librarys, such as helper
|
||||
│ │ ├─ pinia # state management
|
||||
│ │ ├─ routes # vue routes
|
||||
│ │ ├─ views # vue views
|
||||
│ │ ├─ gettext.ts # define translations
|
||||
│ │ ├─ style.less # global style, using less syntax
|
||||
│ │ ├─ dark.less # dark style, using less syntax
|
||||
│ │ └─ ...
|
||||
│ └─ ...
|
||||
└─ ...
|
||||
```
|
||||
|
||||
## Backend
|
||||
|
||||
```
|
||||
.
|
||||
├─ server
|
||||
│ ├─ internal # internal packages
|
||||
│ │ └─ ...
|
||||
│ ├─ api # api to forntend
|
||||
│ ├─ model # model for generate
|
||||
│ ├─ query # generated request files by gen
|
||||
│ ├─ router # routers and middleware
|
||||
│ ├─ service # servie files
|
||||
│ ├─ settings # settings interface
|
||||
│ ├─ test # unit test
|
||||
│ └─ ...
|
||||
├─ main.go # entry point for server
|
||||
└─ ...
|
||||
```
|
||||
|
||||
## Template
|
||||
|
||||
|
||||
```
|
||||
.
|
||||
├─ template
|
||||
│ ├─ block # template for Nginx block
|
||||
│ ├─ conf # template for Nginx configuration
|
||||
│ └─ template.go # embed template files to backend
|
||||
└─ ...
|
||||
```
|
||||
@ -0,0 +1,37 @@
|
||||
# 构建
|
||||
|
||||
构建指南仅适用于开发人员或高级用户。
|
||||
普通用户应遵循 [快速入门](./getting-started) 指南。
|
||||
|
||||
## 依赖
|
||||
|
||||
- Make
|
||||
- Golang 版本 1.20 或更高
|
||||
- node.js 版本 18 或更高
|
||||
|
||||
你需要在构建项目之前执行以下命令更新浏览器列表数据库。
|
||||
```shell
|
||||
npx browserslist@latest --update-db
|
||||
```
|
||||
|
||||
## 构建前端
|
||||
|
||||
请在 `frontend` 目录中执行以下命令。
|
||||
|
||||
```shell
|
||||
yarn install
|
||||
make translations
|
||||
yarn build
|
||||
```
|
||||
|
||||
## 构建后端
|
||||
|
||||
::: warning 警告
|
||||
在构建后端之前应先构建前端,因为后端将嵌入前端构建的文件。
|
||||
:::
|
||||
|
||||
请在项目的根目录执行以下命令。
|
||||
|
||||
```shell
|
||||
go build -o nginx-ui -v main.go
|
||||
```
|
||||
@ -0,0 +1,86 @@
|
||||
# 项目结构
|
||||
|
||||
## 根目录
|
||||
|
||||
```
|
||||
.
|
||||
├─ docs # 文档目录
|
||||
├─ cmd # 命令行工具
|
||||
├─ frontend # 使用 Vue 3 构建的前端
|
||||
├─ server # 使用 Golang 构建的后端
|
||||
├─ resources # 其他资源,不参与构建
|
||||
├─ template # 用于 Nginx 的模板文件
|
||||
├─ app.example.ini # 配置文件的示例
|
||||
├─ main.go # 服务器入口
|
||||
└─ ...
|
||||
```
|
||||
|
||||
## 文档目录
|
||||
|
||||
```
|
||||
.
|
||||
├─ docs
|
||||
│ ├─ .vitepress # 配置目录
|
||||
│ │ ├─ config
|
||||
│ │ └─ theme
|
||||
│ ├─ public # 资源
|
||||
│ ├─ [language code] # 翻译,文件夹名为语言代码,例如 zh_CN, zh_TW
|
||||
│ ├─ guide
|
||||
│ │ └─ *.md # 手册 markdown 文件
|
||||
│ └─ index.md # 首页 markdown 文件
|
||||
└─ ...
|
||||
```
|
||||
|
||||
## 前端
|
||||
|
||||
```
|
||||
.
|
||||
├─ frontend
|
||||
│ ├─ public # 公共资源
|
||||
│ ├─ src # 源代码
|
||||
│ │ ├─ api # 向后端发起请求的 API
|
||||
│ │ ├─ assets # 公共资源
|
||||
│ │ ├─ components # Vue 组件
|
||||
│ │ ├─ language # 翻译,使用 vue3-gettext
|
||||
│ │ ├─ layouts # Vue 布局
|
||||
│ │ ├─ lib # 库文件,如帮助函数
|
||||
│ │ ├─ pinia # 状态管理
|
||||
│ │ ├─ routes # Vue 路由
|
||||
│ │ ├─ views # Vue 视图
|
||||
│ │ ├─ gettext.ts # 定义翻译
|
||||
│ │ ├─ style.less # 全局样式,使用 less 语法
|
||||
│ │ ├─ dark.less # 暗黑主题样式,使用 less 语法
|
||||
│ │ └─ ...
|
||||
│ └─ ...
|
||||
└─ ...
|
||||
```
|
||||
|
||||
## 后端
|
||||
|
||||
```
|
||||
.
|
||||
├─ server
|
||||
│ ├─ internal # 内部包
|
||||
│ │ └─ ...
|
||||
│ ├─ api # 向前端提供的 API
|
||||
│ ├─ model # 自动生成的模型
|
||||
│ ├─ query # gen 自动生成的请求文件
|
||||
│ ├─ router # 路由和中间件
|
||||
│ ├─ service # 服务文件
|
||||
│ ├─ settings # 配置接口
|
||||
│ ├─ test # 单元测试
|
||||
│ └─ ...
|
||||
├─ main.go # 后端入口
|
||||
└─ ...
|
||||
```
|
||||
|
||||
## 模板
|
||||
|
||||
```
|
||||
.
|
||||
├─ template
|
||||
│ ├─ block # Nginx 块配置模板
|
||||
│ ├─ conf # Nginx 配置模板
|
||||
│ └─ template.go # 嵌入模板文件至后端
|
||||
└─ ...
|
||||
```
|
||||
Loading…
Reference in New Issue