docs(wip): english documentation for v2

This commit is contained in:
0xJacky 2024-01-16 00:11:15 +08:00
parent 2d52ada657
commit 81db62b5ba
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
11 changed files with 167 additions and 63 deletions

View file

@ -35,7 +35,7 @@ export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
collapsed: false, collapsed: false,
items: [ items: [
{text: 'Server', link: '/guide/config-server'}, {text: 'Server', link: '/guide/config-server'},
{text: 'Nginx Log', link: '/guide/config-nginx'}, {text: 'Nginx', link: '/guide/config-nginx'},
{text: 'Open AI', link: '/guide/config-openai'}, {text: 'Open AI', link: '/guide/config-openai'},
{text: 'Casdoor', link: '/guide/config-casdoor'} {text: 'Casdoor', link: '/guide/config-casdoor'}
] ]

View file

@ -39,7 +39,7 @@ export const zhTWConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
collapsed: false, collapsed: false,
items: [ items: [
{text: '服務端', link: '/zh_TW/guide/config-server'}, {text: '服務端', link: '/zh_TW/guide/config-server'},
{text: 'Nginx 日誌', link: '/zh_TW/guide/config-nginx'}, {text: 'Nginx', link: '/zh_TW/guide/config-nginx'},
{text: 'Open AI', link: '/zh_TW/guide/config-openai'}, {text: 'Open AI', link: '/zh_TW/guide/config-openai'},
{text: 'Casdoor', link: '/zh_TW/guide/config-casdoor'} {text: 'Casdoor', link: '/zh_TW/guide/config-casdoor'}
] ]

View file

@ -64,7 +64,7 @@ managing your Nginx server.
Nginx UI is available on the following platforms: Nginx UI is available on the following platforms:
- Mac OS X 10.10 Yosemite and later (amd64 / arm64) - macOS 11 Big Sur and later (amd64 / arm64)
- Linux 2.6.23 and later (x86 / amd64 / arm64 / armv5 / armv6 / armv7) - Linux 2.6.23 and later (x86 / amd64 / arm64 / armv5 / armv6 / armv7)
- Including but not limited to Debian 7 / 8, Ubuntu 12.04 / 14.04 and later, CentOS 6 / 7, Arch Linux - Including but not limited to Debian 7 / 8, Ubuntu 12.04 / 14.04 and later, CentOS 6 / 7, Arch Linux
- FreeBSD - FreeBSD

View file

@ -6,8 +6,8 @@ Regular users should follow the [quick start](./getting-started) guide.
## Prerequisites ## Prerequisites
- Make. - Make.
- Golang version 1.20 or higher. - Golang version 1.21 or higher.
- node.js version 18 or higher. - node.js version 21 or higher.
You should execute the following command to update browser list database before build project. You should execute the following command to update browser list database before build project.
```shell ```shell
@ -32,5 +32,5 @@ Before building the backend, the app should be built first because the backend w
Please execute the following command in the project root directory. Please execute the following command in the project root directory.
```shell ```shell
go build -o nginx-ui -v main.go go build -tags=jsoniter -ldflags "$LD_FLAGS -X 'github.com/0xJacky/Nginx-UI/server/settings.buildTime=$(date +%s)'" -o nginx-ui -v main.go
``` ```

View file

@ -1,39 +1,45 @@
# Casdoor # Casdoor
本节介绍如何配置 Casdoor 作为 Nginx UI 的身份验证提供程序,该功能由 @Jraaay 贡献。 This section describes how to configure Casdoor as an authentication provider for Nginx UI, contributed by @Jraaay.
Casdoor 是一个强大的、全面的身份认证解决方案,支持 OAuth 2.0、SAML 2.0、LDAP、AD 和多种社交登录方式。通过集成 CasdoorNginx UI 可以利用这些功能来提升安全性和用户体验。 Casdoor is a powerful and comprehensive identity authentication solution that supports OAuth 2.0, SAML 2.0, LDAP, AD, and multiple social login methods.
By integrating Casdoor, Nginx UI can leverage these features to improve security and user experience.
## Endpoint ## Endpoint
- 类型:`string` - Type: `string`
这是 Casdoor 服务器的 URL。您需要确保 Nginx UI 可以访问此 URL。 This is the Endpoint of the Casdoor server. You need to make sure that Nginx UI can access this URL.
## ClientId ## ClientId
- 类型:`string` - Type: `string`
这是 Casdoor 为您的应用生成的客户端 ID。它用于在身份验证过程中标识您的应用。 This is the Client ID generated by Casdoor for your application.
It is used to identify your application during the authentication process.
## ClientSecret ## ClientSecret
- 类型:`string` - Type: `string`
这是 Casdoor 为您的应用生成的客户端密钥。它是保持您的应用安全所必需的。 This is the Client Secret generated by Casdoor for your application.
It is necessary to keep your application secure.
## Certificate ## Certificate
- 类型:`string` - Type: `string`
这是用于身份验证过程中的证书。确保它是有效和可信的。 This is the certificate used during the authentication process.
Make sure it is valid and trusted.
## Organization ## Organization
- 类型:`string` - Type: `string`
这是您在 Casdoor 中设置的组织名称。Casdoor 将使用此信息来处理身份验证请求。 This is the organization name you set in Casdoor.
It will use this information to process authentication requests.
## Application ## Application
- 类型:`string` - Type: `string`
这是您在 Casdoor 中创建的应用名称。 This is the application name you created in Casdoor.
## RedirectUri ## RedirectUri
- 类型:`string` - Type: `string`
这是用户在成功登录或授权后重定向到的 URI。它应与 Casdoor 应用配置中的重定向 URI 一致。 This is the URI that users will be redirected to after successful login or authorization.
It should be consistent with the Redirect URI in the Casdoor application configuration.

View file

@ -1,17 +1,19 @@
# Nginx Log # Nginx
Nginx logs are essential for monitoring, troubleshooting, and maintaining your web server. They provide valuable In this section, we will introduce configuration options in Nginx UI about Nginx control commands, log paths, and other parameters.
insights into server performance, user behavior, and potential issues. In this section, we will discuss the two primary
types of logs: access logs and error logs.
For Nginx-UI Docker users who are upgrading from v1.5.2 or earlier versions, it is crucial to add separate `access_log` ::: tip Tip
and `error_log` directives in your `nginx.conf` before configuring the `app.ini`. Starting from Nginx UI v2.0.0-beta.3, we have renamed the `nginx_log` configuration item to `nginx`.
:::
In the Nginx-UI container, `/var/log/nginx/access.log` is a symlink pointing to `/dev/stdout`, ## Logs
and `/var/log/nginx/error.log` Nginx logs are crucial for monitoring, troubleshooting, and maintaining your web server. They provide valuable insights into server performance, user behavior, and potential issues.
is a symlink pointing to `/dev/stderr`. This setup allows you to view both the Nginx and Nginx-UI logs using the `docker
logs nginx-ui` command. However, these two devices do not support the tail command, so it is necessary to use additional In this section, we will discuss two main types of logs: access logs and error logs.
log files to record Nginx logs.
For Nginx-UI Docker users upgrading from version v1.5.2 or earlier, you need to add separate `access_log` and `error_log` directives in `nginx.conf` before configuring `app.ini`.
In the Nginx-UI container, `/var/log/nginx/access.log` is a symbolic link to `/dev/stdout`, and `/var/log/nginx/error.log` is a symbolic link to `/dev/stderr`. This setup allows you to view Nginx and Nginx-UI logs using the `docker logs nginx-ui` command. However, these devices do not support the `tail` command, so it is necessary to use additional log files to record Nginx logs.
Example: Example:
@ -27,7 +29,7 @@ http {
} }
``` ```
Additionally, set nginx access log and error log path in `app.ini` and restart nginx-ui. Afterward, set the nginx access log and error log paths in `app.ini`, then restart nginx-ui.
Example: Example:
@ -37,14 +39,90 @@ AccessLogPath = /var/log/nginx/access.local.log
ErrorLogPath = /var/log/nginx/error.local.log ErrorLogPath = /var/log/nginx/error.local.log
``` ```
## AccessLogPath ### AccessLogPath
- Type: `string` - Type: `string`
This option is used to set the path of nginx access log for Nginx UI, so we can view the log content online. This option is used to set the path for Nginx access logs in Nginx UI, allowing us to view log content online.
## ErrorLogPath ::: tip Tip
In Nginx UI v2, we parse the output of the `nginx -V` command to get the default path for Nginx access logs.
If you need to set a different path, you can use this option.
:::
### ErrorLogPath
- Type: `string` - Type: `string`
This option is used to set the path of nginx error log for Nginx UI, so we can view the log content online. This option is used to set the path for Nginx error logs in Nginx UI, allowing us to view log content online.
::: tip Tip
In Nginx UI v2, we parse the output of the `nginx -V` command to get the default path for Nginx error logs.
If you need to set a different path, you can use this option.
:::
## Service Monitoring and Control
In this section, we will introduce configuration options in Nginx UI for monitoring and controlling Nginx services.
### ConfigDir
- Type: `string`
This option is used to set the path for the Nginx configuration folder.
In Nginx UI v2, we parse the output of the `nginx -V` command to get the default path for the Nginx configuration file.
If you need to override the default path, you can use this option.
### PIDPath
- Type: `string`
This option is used to set the path for the Nginx PID file. Nginx UI determines the running status of the Nginx service by checking if this file exists.
In Nginx UI v2, we parse the output of the `nginx -V` command to get the default path for the Nginx PID file.
If you need to override the default path, you can use this option.
### TestConfigCmd
- Type: `string`
- Default: `nginx -t`
This option is used to set the command for testing the Nginx configuration.
### ReloadCmd
- Type: `string`
- Default: `nginx -s reload`
This option is used to set the command for reloading the Nginx configuration.
### RestartCmd
- Type: `string`
::: tip Tip
We recommend users who manage Nginx with systemd to set this value to `systemctl restart nginx`.
Otherwise, after restarting Nginx in the Nginx UI, you will not be able to get the accurate status of Nginx in systemctl.
:::
If this option is left empty, Nginx UI will use the following command to stop the Nginx service:
```bash
start-stop-daemon --stop --quiet --oknodo --retry=TERM/30/KILL/5 --pidfile $PID
```
If the `--sbin-path` path cannot be obtained from `nginx -V`, Nginx UI will use the following command to start the Nginx service:
```bash
nginx
```
If the `--sbin-path` path can be obtained, Nginx UI will use the following command to start the Nginx service:
```bash
start-stop-daemon --start --quiet --pidfile $PID --exec $SBIN_PATH
```

View file

@ -3,6 +3,13 @@
The server section of the Nginx UI configuration deals with various settings that control the behavior and operation of The server section of the Nginx UI configuration deals with various settings that control the behavior and operation of
the Nginx UI server. In this section, we will discuss the available options, their default values, and their purpose. the Nginx UI server. In this section, we will discuss the available options, their default values, and their purpose.
## HttpHost
- Type: `string`
- Default`0.0.0.0`
The hostname on which the Nginx UI server listens for incoming HTTP requests.
Changing the default hostname can be useful for improving the security of Nginx UI.
## HttpPort ## HttpPort
- Type: `int` - Type: `int`
@ -14,12 +21,25 @@ HTTP requests. Changing the default port can be useful for avoiding port conflic
## RunMode ## RunMode
- Type: `string` - Type: `string`
- Supported value: `release`, `debug` - Supported value: `release``debug`
- Default: `debug`
::: tip This option is used to configure the running mode of the Nginx UI server, which mainly affects the level of log printing.
At present, we have not yet adapted to this option, and there will be no significant differences between release and
debug in terms of usage. The log level of Nginx UI is divided into 6 levels: `Debug`, `Info`, `Warn`, `Error`, `Panic` and `Fatal`. These log levels increase in severity.
:::
When using the `debug` mode, Nginx UI will print SQL and its execution time and caller on the console, and the log of `Debug` level or higher will also be printed.
When using the `release` mode, Nginx UI will not print the execution time and caller of SQL on the console, and only the log of `Info` level or higher will be printed.
## JwtSecret
- Type: `string`
This option is used to configure the key used by the Nginx UI server to generate JWT.
JWT is a standard for verifying user identity. It can generate a token after the user logs in, and then use the token to verify the user's identity in subsequent requests.
If you use the one-click installation script to deploy Nginx UI, the script will generate a UUID value and set it as the value of this option.
## HTTPChallengePort ## HTTPChallengePort
@ -30,6 +50,12 @@ This option is used to set the port for backend listening in the HTTP01 challeng
certificates. The HTTP01 challenge is a domain validation method used by Let's Encrypt to verify that you control the certificates. The HTTP01 challenge is a domain validation method used by Let's Encrypt to verify that you control the
domain for which you're requesting a certificate. domain for which you're requesting a certificate.
## Email
- Type: `string`
When obtaining a Let's Encrypt certificate, this option is used to set your email address.
Let's Encrypt will use your email address to notify you of the expiration date of your certificate.
## Database ## Database
- Type: `string` - Type: `string`
@ -75,5 +101,5 @@ CADir needs to comply with the `RFC 8555` standard.
- Type: `string` - Type: `string`
- Suggestion: `https://mirror.ghproxy.com/` - Suggestion: `https://mirror.ghproxy.com/`
For users who may experience difficulties downloading resources from Github (such as in mainland China), this option For users who may experience difficulties downloading resources from GitHub (such as in mainland China), this option
allows them to set a proxy for github.com to improve accessibility. allows them to set a proxy for github.com to improve accessibility.

View file

@ -6,8 +6,7 @@
. .
├─ docs # documentations ├─ docs # documentations
├─ cmd # command-line tool ├─ cmd # command-line tool
├─ app # app build with vue 3 ├─ app # app build with Vue 3
├─ server # backend build with golang
├─ resources # additional resources, not for build ├─ resources # additional resources, not for build
├─ template # templates for nginx ├─ template # templates for nginx
├─ app.example.ini # example configuration file ├─ app.example.ini # example configuration file
@ -48,8 +47,7 @@
│ │ ├─ routes # vue routes │ │ ├─ routes # vue routes
│ │ ├─ views # vue views │ │ ├─ views # vue views
│ │ ├─ gettext.ts # define translations │ │ ├─ gettext.ts # define translations
│ │ ├─ style.less # global style, using less syntax │ │ ├─ style.css # integrate taildwind
│ │ ├─ dark.less # dark style, using less syntax
│ │ └─ ... │ │ └─ ...
│ └─ ... │ └─ ...
└─ ... └─ ...
@ -59,18 +57,14 @@
``` ```
. .
├─ server ├─ internal # internal packages
│ ├─ internal # internal packages ├─ api # api for frontend
│ │ └─ ... ├─ model # models of database
│ ├─ api # api to forntend ├─ query # database query files generated by gen
│ ├─ model # model for generate ├─ router # router and middleware
│ ├─ query # generated request files by gen ├─ settings # backend settings
│ ├─ router # routers and middleware ├─ test # unit tests
│ ├─ service # servie files ├─ main.go # main program entry
│ ├─ settings # settings interface
│ ├─ test # unit test
│ └─ ...
├─ main.go # entry point for server
└─ ... └─ ...
``` ```

View file

@ -31,5 +31,5 @@ pnpm build
请在项目的根目录执行以下命令。 请在项目的根目录执行以下命令。
```shell ```shell
go build -o nginx-ui -v main.go go build -tags=jsoniter -ldflags "$LD_FLAGS -X 'github.com/0xJacky/Nginx-UI/server/settings.buildTime=$(date +%s)'" -o dist/nginx-ui -v main.go
``` ```

View file

@ -59,7 +59,7 @@
. .
├─ internal # 内部包 ├─ internal # 内部包
├─ api # 向前端提供的 API ├─ api # 向前端提供的 API
├─ model # 自动生成的模型 ├─ model # 数据库模型
├─ query # gen 自动生成的数据库请求文件 ├─ query # gen 自动生成的数据库请求文件
├─ router # 路由和中间件 ├─ router # 路由和中间件
├─ settings # 配置接口 ├─ settings # 配置接口

View file

@ -31,5 +31,5 @@ pnpm build
請在專案的根資料夾執行以下命令。 請在專案的根資料夾執行以下命令。
```shell ```shell
go build -o nginx-ui -v main.go go build -tags=jsoniter -ldflags "$LD_FLAGS -X 'github.com/0xJacky/Nginx-UI/server/settings.buildTime=$(date +%s)'" -o dist/nginx-ui -v main.go
``` ```