diff --git a/docs/.vitepress/config/en.ts b/docs/.vitepress/config/en.ts index 7c41eade..7c44de77 100644 --- a/docs/.vitepress/config/en.ts +++ b/docs/.vitepress/config/en.ts @@ -35,7 +35,7 @@ export const enConfig: LocaleSpecificConfig = { collapsed: false, items: [ {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: 'Casdoor', link: '/guide/config-casdoor'} ] diff --git a/docs/.vitepress/config/zh_TW.ts b/docs/.vitepress/config/zh_TW.ts index a2ee277e..9972e0ed 100644 --- a/docs/.vitepress/config/zh_TW.ts +++ b/docs/.vitepress/config/zh_TW.ts @@ -39,7 +39,7 @@ export const zhTWConfig: LocaleSpecificConfig = { collapsed: false, items: [ {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: 'Casdoor', link: '/zh_TW/guide/config-casdoor'} ] diff --git a/docs/guide/about.md b/docs/guide/about.md index cadbbed8..f5be026e 100644 --- a/docs/guide/about.md +++ b/docs/guide/about.md @@ -64,7 +64,7 @@ managing your Nginx server. 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) - Including but not limited to Debian 7 / 8, Ubuntu 12.04 / 14.04 and later, CentOS 6 / 7, Arch Linux - FreeBSD diff --git a/docs/guide/build.md b/docs/guide/build.md index a76b200d..e8272838 100644 --- a/docs/guide/build.md +++ b/docs/guide/build.md @@ -6,8 +6,8 @@ Regular users should follow the [quick start](./getting-started) guide. ## Prerequisites - Make. -- Golang version 1.20 or higher. -- node.js version 18 or higher. +- Golang version 1.21 or higher. +- node.js version 21 or higher. You should execute the following command to update browser list database before build project. ```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. ```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 ``` diff --git a/docs/guide/config-casdoor.md b/docs/guide/config-casdoor.md index 92331120..3c429e48 100644 --- a/docs/guide/config-casdoor.md +++ b/docs/guide/config-casdoor.md @@ -1,39 +1,45 @@ # 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 和多种社交登录方式。通过集成 Casdoor,Nginx 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 -- 类型:`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 -- 类型:`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 -- 类型:`string` +- Type: `string` -这是 Casdoor 为您的应用生成的客户端密钥。它是保持您的应用安全所必需的。 +This is the Client Secret generated by Casdoor for your application. +It is necessary to keep your application secure. ## Certificate -- 类型:`string` +- Type: `string` -这是用于身份验证过程中的证书。确保它是有效和可信的。 +This is the certificate used during the authentication process. +Make sure it is valid and trusted. ## 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 -- 类型:`string` +- Type: `string` -这是您在 Casdoor 中创建的应用名称。 +This is the application name you created in Casdoor. ## 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. diff --git a/docs/guide/config-nginx.md b/docs/guide/config-nginx.md index 0fedc8cb..be97bbab 100644 --- a/docs/guide/config-nginx.md +++ b/docs/guide/config-nginx.md @@ -1,17 +1,19 @@ -# Nginx Log +# Nginx -Nginx logs are essential for monitoring, troubleshooting, and maintaining your web server. They provide valuable -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. +In this section, we will introduce configuration options in Nginx UI about Nginx control commands, log paths, and other parameters. -For Nginx-UI Docker users who are upgrading from v1.5.2 or earlier versions, it is crucial to add separate `access_log` -and `error_log` directives in your `nginx.conf` before configuring the `app.ini`. +::: tip Tip +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`, -and `/var/log/nginx/error.log` -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 -log files to record Nginx logs. +## Logs +Nginx logs are crucial for monitoring, troubleshooting, and maintaining your web server. They provide valuable insights into server performance, user behavior, and potential issues. + +In this section, we will discuss two main types of logs: access logs and error 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: @@ -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: @@ -37,14 +39,90 @@ AccessLogPath = /var/log/nginx/access.local.log ErrorLogPath = /var/log/nginx/error.local.log ``` -## AccessLogPath +### AccessLogPath - 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` -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 +``` diff --git a/docs/guide/config-server.md b/docs/guide/config-server.md index f8199d1d..02c90df2 100644 --- a/docs/guide/config-server.md +++ b/docs/guide/config-server.md @@ -3,6 +3,13 @@ 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. +## 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 - Type: `int` @@ -14,12 +21,25 @@ HTTP requests. Changing the default port can be useful for avoiding port conflic ## RunMode - Type: `string` -- Supported value: `release`, `debug` +- Supported value: `release`,`debug` +- Default: `debug` -::: tip -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. -::: +This option is used to configure the running mode of the Nginx UI server, which mainly affects the level of log printing. + +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 @@ -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 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 - Type: `string` @@ -75,5 +101,5 @@ CADir needs to comply with the `RFC 8555` standard. - Type: `string` - 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. diff --git a/docs/guide/project-structure.md b/docs/guide/project-structure.md index d0b2f8e2..2736696c 100644 --- a/docs/guide/project-structure.md +++ b/docs/guide/project-structure.md @@ -6,8 +6,7 @@ . ├─ docs # documentations ├─ cmd # command-line tool -├─ app # app build with vue 3 -├─ server # backend build with golang +├─ app # app build with Vue 3 ├─ resources # additional resources, not for build ├─ template # templates for nginx ├─ app.example.ini # example configuration file @@ -48,8 +47,7 @@ │ │ ├─ routes # vue routes │ │ ├─ views # vue views │ │ ├─ gettext.ts # define translations -│ │ ├─ style.less # global style, using less syntax -│ │ ├─ dark.less # dark style, using less syntax +│ │ ├─ style.css # integrate taildwind │ │ └─ ... │ └─ ... └─ ... @@ -59,18 +57,14 @@ ``` . -├─ 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 +├─ internal # internal packages +├─ api # api for frontend +├─ model # models of database +├─ query # database query files generated by gen +├─ router # router and middleware +├─ settings # backend settings +├─ test # unit tests +├─ main.go # main program entry └─ ... ``` diff --git a/docs/zh_CN/guide/build.md b/docs/zh_CN/guide/build.md index ae6776e8..8afa662c 100644 --- a/docs/zh_CN/guide/build.md +++ b/docs/zh_CN/guide/build.md @@ -31,5 +31,5 @@ pnpm build 请在项目的根目录执行以下命令。 ```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 ``` diff --git a/docs/zh_CN/guide/project-structure.md b/docs/zh_CN/guide/project-structure.md index 04161a8d..17fd709a 100644 --- a/docs/zh_CN/guide/project-structure.md +++ b/docs/zh_CN/guide/project-structure.md @@ -59,7 +59,7 @@ . ├─ internal # 内部包 ├─ api # 向前端提供的 API -├─ model # 自动生成的模型 +├─ model # 数据库模型 ├─ query # gen 自动生成的数据库请求文件 ├─ router # 路由和中间件 ├─ settings # 配置接口 diff --git a/docs/zh_TW/guide/build.md b/docs/zh_TW/guide/build.md index 842da781..11ecd7ab 100644 --- a/docs/zh_TW/guide/build.md +++ b/docs/zh_TW/guide/build.md @@ -31,5 +31,5 @@ pnpm build 請在專案的根資料夾執行以下命令。 ```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 ```