chore: 删除文档文件和更新CI配置
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 1m31s
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 1m31s
移除不再需要的文档文件,包括架构图、安装指南和配置指南 更新CI工作流配置,使用预装工具的Docker镜像并简化安装步骤
This commit is contained in:
parent
29eede21e1
commit
b8756be3cc
@ -33,7 +33,9 @@ jobs:
|
||||
build:
|
||||
runs-on: ario-server
|
||||
container:
|
||||
image: node:20
|
||||
# 使用包含 Docker、curl、jq、Node.js 的镜像
|
||||
image: cimg/node:20.15.1
|
||||
options: --privileged
|
||||
strategy:
|
||||
matrix:
|
||||
# 只有node支持版本号别名
|
||||
@ -64,35 +66,9 @@ jobs:
|
||||
fi
|
||||
|
||||
# 步骤3: 安装系统工具 (Docker, curl, jq)
|
||||
- name: 🔧 安装系统工具 (Docker, curl, jq)
|
||||
- name: 🔧 验证预装工具
|
||||
run: |
|
||||
set -e
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "等待 apt/dpkg 锁释放 (unattended-upgrades)..."
|
||||
# 等待最多 300 秒让 unattended-upgrades/apt/dpkg 锁释放
|
||||
end=$((SECONDS+300))
|
||||
while true; do
|
||||
LOCKS_BUSY=0
|
||||
# 如果 unattended-upgrades 正在运行,标记为忙碌
|
||||
if pgrep -x unattended-upgrades >/dev/null 2>&1; then LOCKS_BUSY=1; fi
|
||||
# 如果 fuser 存在,检查常见的锁文件
|
||||
if command -v fuser >/dev/null 2>&1; then
|
||||
if fuser /var/lib/dpkg/lock >/dev/null 2>&1 \
|
||||
|| fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 \
|
||||
|| fuser /var/lib/apt/lists/lock >/dev/null 2>&1; then
|
||||
LOCKS_BUSY=1
|
||||
fi
|
||||
fi
|
||||
# 如果不忙碌则跳出循环
|
||||
if [ "$LOCKS_BUSY" -eq 0 ]; then break; fi
|
||||
# 超时后约 5 分钟
|
||||
if [ $SECONDS -ge $end ]; then
|
||||
echo "等待 apt/dpkg 锁超时,使用 Dpkg::Lock::Timeout 继续..."
|
||||
break
|
||||
fi
|
||||
echo "仍在等待锁释放..."; sleep 5
|
||||
done
|
||||
apt-get install -y -o Dpkg::Lock::Timeout=600
|
||||
echo "验证预装工具版本..."
|
||||
docker --version
|
||||
jq --version
|
||||
curl --version
|
||||
|
||||
161
doc/config-zh.md
161
doc/config-zh.md
@ -1,161 +0,0 @@
|
||||
# PPanel 配置指南
|
||||
|
||||
本文件为 PPanel 应用程序的配置文件提供全面指南。配置文件采用 YAML 格式,定义了服务器、日志、数据库、Redis 和管理员访问的相关设置。
|
||||
|
||||
## 1. 配置文件概述
|
||||
|
||||
- **默认路径**:`./etc/ppanel.yaml`
|
||||
- **自定义路径**:通过启动参数 `--config` 指定配置文件路径。
|
||||
- **格式**:YAML 格式,支持注释,文件名需以 `.yaml` 结尾。
|
||||
|
||||
## 2. 配置文件结构
|
||||
|
||||
以下是配置文件示例,包含默认值和说明:
|
||||
|
||||
```yaml
|
||||
# PPanel 配置文件
|
||||
Host: "0.0.0.0" # 服务监听地址
|
||||
Port: 8080 # 服务监听端口
|
||||
Debug: false # 是否开启调试模式(禁用后台日志)
|
||||
JwtAuth: # JWT 认证配置
|
||||
AccessSecret: "" # 访问令牌密钥(为空时随机生成)
|
||||
AccessExpire: 604800 # 访问令牌过期时间(秒)
|
||||
Logger: # 日志配置
|
||||
ServiceName: "" # 日志服务标识名称
|
||||
Mode: "console" # 日志输出模式(console、file、volume)
|
||||
Encoding: "json" # 日志格式(json、plain)
|
||||
TimeFormat: "2006-01-02T15:04:05.000Z07:00" # 自定义时间格式
|
||||
Path: "logs" # 日志文件目录
|
||||
Level: "info" # 日志级别(info、error、severe)
|
||||
Compress: false # 是否压缩日志文件
|
||||
KeepDays: 7 # 日志保留天数
|
||||
StackCooldownMillis: 100 # 堆栈日志冷却时间(毫秒)
|
||||
MaxBackups: 3 # 最大日志备份数
|
||||
MaxSize: 50 # 最大日志文件大小(MB)
|
||||
Rotation: "daily" # 日志轮转策略(daily、size)
|
||||
MySQL: # MySQL 数据库配置
|
||||
Addr: "" # MySQL 地址(必填)
|
||||
Username: "" # MySQL 用户名(必填)
|
||||
Password: "" # MySQL 密码(必填)
|
||||
Dbname: "" # MySQL 数据库名(必填)
|
||||
Config: "charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai" # MySQL 连接参数
|
||||
MaxIdleConns: 10 # 最大空闲连接数
|
||||
MaxOpenConns: 100 # 最大打开连接数
|
||||
LogMode: "info" # 日志级别(debug、error、warn、info)
|
||||
LogZap: true # 是否使用 Zap 记录 SQL 日志
|
||||
SlowThreshold: 1000 # 慢查询阈值(毫秒)
|
||||
Redis: # Redis 配置
|
||||
Host: "localhost:6379" # Redis 地址
|
||||
Pass: "" # Redis 密码
|
||||
DB: 0 # Redis 数据库索引
|
||||
Administer: # 管理员登录配置
|
||||
Email: "admin@ppanel.dev" # 管理员登录邮箱
|
||||
Password: "password" # 管理员登录密码
|
||||
```
|
||||
|
||||
## 3. 配置项说明
|
||||
|
||||
### 3.1 服务器设置
|
||||
|
||||
- **`Host`**:服务监听的地址。
|
||||
- 默认:`0.0.0.0`(监听所有网络接口)。
|
||||
- **`Port`**:服务监听的端口。
|
||||
- 默认:`8080`。
|
||||
- **`Debug`**:是否开启调试模式,开启后禁用后台日志功能。
|
||||
- 默认:`false`。
|
||||
|
||||
### 3.2 JWT 认证 (`JwtAuth`)
|
||||
|
||||
- **`AccessSecret`**:访问令牌的密钥。
|
||||
- 默认:为空时随机生成。
|
||||
- **`AccessExpire`**:令牌过期时间(秒)。
|
||||
- 默认:`604800`(7天)。
|
||||
|
||||
### 3.3 日志配置 (`Logger`)
|
||||
|
||||
- **`ServiceName`**:日志的服务标识名称,在 `volume` 模式下用作日志文件名。
|
||||
- 默认:`""`。
|
||||
- **`Mode`**:日志输出方式。
|
||||
- 选项:`console`(标准输出/错误输出)、`file`(写入指定目录)、`volume`(Docker 卷)。
|
||||
- 默认:`console`。
|
||||
- **`Encoding`**:日志格式。
|
||||
- 选项:`json`(结构化 JSON)、`plain`(纯文本,带颜色)。
|
||||
- 默认:`json`。
|
||||
- **`TimeFormat`**:日志时间格式。
|
||||
- 默认:`2006-01-02T15:04:05.000Z07:00`。
|
||||
- **`Path`**:日志文件存储目录。
|
||||
- 默认:`logs`。
|
||||
- **`Level`**:日志过滤级别。
|
||||
- 选项:`info`(记录所有日志)、`error`(仅错误和严重日志)、`severe`(仅严重日志)。
|
||||
- 默认:`info`。
|
||||
- **`Compress`**:是否压缩日志文件(仅在 `file` 模式下生效)。
|
||||
- 默认:`false`。
|
||||
- **`KeepDays`**:日志文件保留天数。
|
||||
- 默认:`7`。
|
||||
- **`StackCooldownMillis`**:堆栈日志冷却时间(毫秒),防止日志过多。
|
||||
- 默认:`100`。
|
||||
- **`MaxBackups`**:最大日志备份数量(仅在 `size` 轮转时生效)。
|
||||
- 默认:`3`。
|
||||
- **`MaxSize`**:日志文件最大大小(MB,仅在 `size` 轮转时生效)。
|
||||
- 默认:`50`。
|
||||
- **`Rotation`**:日志轮转策略。
|
||||
- 选项:`daily`(按天轮转)、`size`(按大小轮转)。
|
||||
- 默认:`daily`。
|
||||
|
||||
### 3.4 MySQL 数据库 (`MySQL`)
|
||||
|
||||
- **`Addr`**:MySQL 服务器地址。
|
||||
- 必填。
|
||||
- **`Username`**:MySQL 用户名。
|
||||
- 必填。
|
||||
- **`Password`**:MySQL 密码。
|
||||
- 必填。
|
||||
- **`Dbname`**:MySQL 数据库名。
|
||||
- 必填。
|
||||
- **`Config`**:MySQL 连接参数。
|
||||
- 默认:`charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai`。
|
||||
- **`MaxIdleConns`**:最大空闲连接数。
|
||||
- 默认:`10`。
|
||||
- **`MaxOpenConns`**:最大打开连接数。
|
||||
- 默认:`100`。
|
||||
- **`LogMode`**:SQL 日志级别。
|
||||
- 选项:`debug`、`error`、`warn`、`info`。
|
||||
- 默认:`info`。
|
||||
- **`LogZap`**:是否使用 Zap 记录 SQL 日志。
|
||||
- 默认:`true`。
|
||||
- **`SlowThreshold`**:慢查询阈值(毫秒)。
|
||||
- 默认:`1000`。
|
||||
|
||||
### 3.5 Redis 配置 (`Redis`)
|
||||
|
||||
- **`Host`**:Redis 服务器地址。
|
||||
- 默认:`localhost:6379`。
|
||||
- **`Pass`**:Redis 密码。
|
||||
- 默认:`""`(无密码)。
|
||||
- **`DB`**:Redis 数据库索引。
|
||||
- 默认:`0`。
|
||||
|
||||
### 3.6 管理员登录 (`Administer`)
|
||||
|
||||
- **`Email`**:管理员登录邮箱。
|
||||
- 默认:`admin@ppanel.dev`。
|
||||
- **`Password`**:管理员登录密码。
|
||||
- 默认:`password`。
|
||||
|
||||
## 4. 环境变量
|
||||
|
||||
以下环境变量可用于覆盖配置文件中的设置:
|
||||
|
||||
| 环境变量 | 配置项 | 示例值 |
|
||||
|----------------|----------|----------------------------------------------|
|
||||
| `PPANEL_DB` | MySQL 配置 | `root:password@tcp(localhost:3306)/vpnboard` |
|
||||
| `PPANEL_REDIS` | Redis 配置 | `redis://localhost:6379` |
|
||||
|
||||
## 5. 最佳实践
|
||||
|
||||
- **安全性**:生产环境中避免使用默认的 `Administer` 凭据,更新 `Email` 和 `Password` 为安全值。
|
||||
- **日志**:生产环境中建议使用 `file` 或 `volume` 模式持久化日志,将 `Level` 设置为 `error` 或 `severe` 以减少日志量。
|
||||
- **数据库**:确保 `MySQL` 和 `Redis` 凭据安全,避免在版本控制中暴露。
|
||||
- **JWT**:为 `JwtAuth` 的 `AccessSecret` 设置强密钥以增强安全性。
|
||||
|
||||
如需进一步帮助,请参考 PPanel 官方文档或联系支持团队。
|
||||
164
doc/config.md
164
doc/config.md
@ -1,164 +0,0 @@
|
||||
# PPanel Configuration Guide
|
||||
|
||||
This document provides a comprehensive guide to the configuration file for the PPanel application. The configuration
|
||||
file is in YAML format and defines settings for the server, logging, database, Redis, and admin access.
|
||||
|
||||
## 1. Configuration File Overview
|
||||
|
||||
- **Default Path**: `./etc/ppanel.yaml`
|
||||
- **Custom Path**: Specify a custom path using the `--config` startup parameter.
|
||||
- **Format**: YAML, supports comments, and must be named with a `.yaml` extension.
|
||||
|
||||
## 2. Configuration File Structure
|
||||
|
||||
Below is an example of the configuration file with default values and explanations:
|
||||
|
||||
```yaml
|
||||
# PPanel Configuration
|
||||
Host: "0.0.0.0" # Server listening address
|
||||
Port: 8080 # Server listening port
|
||||
Debug: false # Enable debug mode (disables background logging)
|
||||
JwtAuth: # JWT authentication settings
|
||||
AccessSecret: "" # Access token secret (randomly generated if empty)
|
||||
AccessExpire: 604800 # Access token expiration (seconds)
|
||||
Logger: # Logging configuration
|
||||
ServiceName: "" # Service name for log identification
|
||||
Mode: "console" # Log output mode (console, file, volume)
|
||||
Encoding: "json" # Log format (json, plain)
|
||||
TimeFormat: "2006-01-02T15:04:05.000Z07:00" # Custom time format
|
||||
Path: "logs" # Log file directory
|
||||
Level: "info" # Log level (info, error, severe)
|
||||
Compress: false # Enable log compression
|
||||
KeepDays: 7 # Log retention period (days)
|
||||
StackCooldownMillis: 100 # Stack trace cooldown (milliseconds)
|
||||
MaxBackups: 3 # Maximum number of log backups
|
||||
MaxSize: 50 # Maximum log file size (MB)
|
||||
Rotation: "daily" # Log rotation strategy (daily, size)
|
||||
MySQL: # MySQL database configuration
|
||||
Addr: "" # MySQL address (required)
|
||||
Username: "" # MySQL username (required)
|
||||
Password: "" # MySQL password (required)
|
||||
Dbname: "" # MySQL database name (required)
|
||||
Config: "charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai" # MySQL connection parameters
|
||||
MaxIdleConns: 10 # Maximum idle connections
|
||||
MaxOpenConns: 100 # Maximum open connections
|
||||
LogMode: "info" # Log level (debug, error, warn, info)
|
||||
LogZap: true # Enable Zap logging for SQL
|
||||
SlowThreshold: 1000 # Slow query threshold (milliseconds)
|
||||
Redis: # Redis configuration
|
||||
Host: "localhost:6379" # Redis address
|
||||
Pass: "" # Redis password
|
||||
DB: 0 # Redis database index
|
||||
Administer: # Admin login configuration
|
||||
Email: "admin@ppanel.dev" # Admin login email
|
||||
Password: "password" # Admin login password
|
||||
```
|
||||
|
||||
## 3. Configuration Details
|
||||
|
||||
### 3.1 Server Settings
|
||||
|
||||
- **`Host`**: Address the server listens on.
|
||||
- Default: `0.0.0.0` (all network interfaces).
|
||||
- **`Port`**: Port the server listens on.
|
||||
- Default: `8080`.
|
||||
- **`Debug`**: Enables debug mode, disabling background logging.
|
||||
- Default: `false`.
|
||||
|
||||
### 3.2 JWT Authentication (`JwtAuth`)
|
||||
|
||||
- **`AccessSecret`**: Secret key for access tokens.
|
||||
- Default: Randomly generated if not specified.
|
||||
- **`AccessExpire`**: Token expiration time in seconds.
|
||||
- Default: `604800` (7 days).
|
||||
|
||||
### 3.3 Logging (`Logger`)
|
||||
|
||||
- **`ServiceName`**: Identifier for logs, used as the log filename in `volume` mode.
|
||||
- Default: `""`.
|
||||
- **`Mode`**: Log output destination.
|
||||
- Options: `console` (stdout/stderr), `file` (to a directory), `volume` (Docker volume).
|
||||
- Default: `console`.
|
||||
- **`Encoding`**: Log format.
|
||||
- Options: `json` (structured JSON), `plain` (plain text with colors).
|
||||
- Default: `json`.
|
||||
- **`TimeFormat`**: Custom time format for logs.
|
||||
- Default: `2006-01-02T15:04:05.000Z07:00`.
|
||||
- **`Path`**: Directory for log files.
|
||||
- Default: `logs`.
|
||||
- **`Level`**: Log filtering level.
|
||||
- Options: `info` (all logs), `error` (error and severe), `severe` (severe only).
|
||||
- Default: `info`.
|
||||
- **`Compress`**: Enable compression for log files (only in `file` mode).
|
||||
- Default: `false`.
|
||||
- **`KeepDays`**: Retention period for log files (in days).
|
||||
- Default: `7`.
|
||||
- **`StackCooldownMillis`**: Cooldown for stack trace logging to prevent log flooding.
|
||||
- Default: `100`.
|
||||
- **`MaxBackups`**: Maximum number of log backups (for `size` rotation).
|
||||
- Default: `3`.
|
||||
- **`MaxSize`**: Maximum log file size in MB (for `size` rotation).
|
||||
- Default: `50`.
|
||||
- **`Rotation`**: Log rotation strategy.
|
||||
- Options: `daily` (rotate daily), `size` (rotate by size).
|
||||
- Default: `daily`.
|
||||
|
||||
### 3.4 MySQL Database (`MySQL`)
|
||||
|
||||
- **`Addr`**: MySQL server address.
|
||||
- Required.
|
||||
- **`Username`**: MySQL username.
|
||||
- Required.
|
||||
- **`Password`**: MySQL password.
|
||||
- Required.
|
||||
- **`Dbname`**: MySQL database name.
|
||||
- Required.
|
||||
- **`Config`**: MySQL connection parameters.
|
||||
- Default: `charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai`.
|
||||
- **`MaxIdleConns`**: Maximum idle connections.
|
||||
- Default: `10`.
|
||||
- **`MaxOpenConns`**: Maximum open connections.
|
||||
- Default: `100`.
|
||||
- **`LogMode`**: SQL logging level.
|
||||
- Options: `debug`, `error`, `warn`, `info`.
|
||||
- Default: `info`.
|
||||
- **`LogZap`**: Enable Zap logging for SQL queries.
|
||||
- Default: `true`.
|
||||
- **`SlowThreshold`**: Threshold for slow query logging (in milliseconds).
|
||||
- Default: `1000`.
|
||||
|
||||
### 3.5 Redis (`Redis`)
|
||||
|
||||
- **`Host`**: Redis server address.
|
||||
- Default: `localhost:6379`.
|
||||
- **`Pass`**: Redis password.
|
||||
- Default: `""` (no password).
|
||||
- **`DB`**: Redis database index.
|
||||
- Default: `0`.
|
||||
|
||||
### 3.6 Admin Login (`Administer`)
|
||||
|
||||
- **`Email`**: Admin login email.
|
||||
- Default: `admin@ppanel.dev`.
|
||||
- **`Password`**: Admin login password.
|
||||
- Default: `password`.
|
||||
|
||||
## 4. Environment Variables
|
||||
|
||||
The following environment variables can be used to override configuration settings:
|
||||
|
||||
| Environment Variable | Configuration Section | Example Value |
|
||||
|----------------------|-----------------------|----------------------------------------------|
|
||||
| `PPANEL_DB` | MySQL | `root:password@tcp(localhost:3306)/vpnboard` |
|
||||
| `PPANEL_REDIS` | Redis | `redis://localhost:6379` |
|
||||
|
||||
## 5. Best Practices
|
||||
|
||||
- **Security**: Avoid using default `Administer` credentials in production. Update `Email` and `Password` to secure
|
||||
values.
|
||||
- **Logging**: Use `file` or `volume` mode for production to persist logs. Adjust `Level` to `error` or `severe` to
|
||||
reduce log volume.
|
||||
- **Database**: Ensure `MySQL` and `Redis` credentials are secure and not exposed in version control.
|
||||
- **JWT**: Specify a strong `AccessSecret` for `JwtAuth` to enhance security.
|
||||
|
||||
For further assistance, refer to the official PPanel documentation or contact support.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 553 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 548 KiB |
@ -1,133 +0,0 @@
|
||||
### 安装说明
|
||||
#### 前置系统要求
|
||||
- Mysql 5.7+ (推荐使用8.0)
|
||||
- Redis 6.0+ (推荐使用7.0)
|
||||
|
||||
#### 二进制安装
|
||||
1.确定系统架构,并下载对应的二进制文件
|
||||
|
||||
下载地址:`https://github.com/perfect-panel/server/releases`
|
||||
|
||||
示例说明:系统:Linux amd64,用户:root,当前目录:/root
|
||||
|
||||
- 下载二进制文件
|
||||
|
||||
```shell
|
||||
$ wget https://github.com/perfect-panel/server/releases/download/v1.0.0/ppanel-server-linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
- 解压二进制文件
|
||||
|
||||
```shell
|
||||
$ tar -zxvf ppanel-server-linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
- 进入解压后的目录
|
||||
|
||||
```shell
|
||||
$ cd ppanel-server-linux-amd64
|
||||
```
|
||||
|
||||
- 赋予二进制文件执行权限
|
||||
|
||||
```shell
|
||||
$ chmod +x ppanel-server
|
||||
```
|
||||
|
||||
- 创建 systemd 服务文件
|
||||
|
||||
```shell
|
||||
$ cat > /etc/systemd/system/ppanel.service <<EOF
|
||||
[Unit]
|
||||
Description=PPANEL Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/root/ppanel-server-linux-amd64/ppanel-server
|
||||
Restart=always
|
||||
User=root
|
||||
WorkingDirectory=/root/ppanel-server-linux-amd64
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
```
|
||||
|
||||
- 重新加载 systemd 服务
|
||||
|
||||
```shell
|
||||
$ systemctl daemon-reload
|
||||
```
|
||||
- 启动服务
|
||||
|
||||
```shell
|
||||
$ systemctl start ppanel
|
||||
```
|
||||
##### 其他说明
|
||||
1. 安装路径:二进制文件将解压到 /root/ppanel-server-linux-amd64 目录下
|
||||
2. systemd 服务:
|
||||
- 服务名称:ppanel
|
||||
- 服务配置文件:/etc/systemd/system/ppanel.service
|
||||
- 服务启动命令:systemctl start ppanel
|
||||
- 服务停止命令:systemctl stop ppanel
|
||||
- 服务重启命令:systemctl restart ppanel
|
||||
- 服务状态命令:systemctl status ppanel
|
||||
- 服务开机自启:systemctl enable ppanel
|
||||
3. 设置开机自启可通过以下命令开机自启
|
||||
```shell
|
||||
$ systemctl enable ppanel
|
||||
```
|
||||
4. 服务日志:服务日志默认输出到 /root/ppanel-server-linux-amd64/ppanel.log 文件中
|
||||
5. 可通过 `journalctl -u ppanel -f` 查看服务日志
|
||||
6. 当配置文件为空或者不存在的情况下,服务会使用默认配置启动,配置文件路径为:`./etc/ppanel.yaml`,
|
||||
请通过`http://服务器地址:8080/init` 初始化系统配置
|
||||
|
||||
#### NGINX 反向代理配置
|
||||
|
||||
以下是反向代理配置示例,将 `ppanel` 服务代理到 `api.ppanel.dev` 域名下
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name ppanel.dev;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
|
||||
#Set Nginx Cache
|
||||
|
||||
set $static_filezbsQiET1 0;
|
||||
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
|
||||
{
|
||||
set $static_filezbsQiET1 1;
|
||||
expires 1m;
|
||||
}
|
||||
if ( $static_filezbsQiET1 = 0 )
|
||||
{
|
||||
add_header Cache-Control no-cache;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
如果使用cloudflare代理服务,需要获取到用户真实访问IP。请在Nginx配置文件中Http段落中加入:
|
||||
|
||||
- 需要依赖:**ngx_http_realip_module**模块, 使用nginx -V命令查看nginx是否已经编译该模块,没有的话需要自己编译。
|
||||
|
||||
|
||||
```nginx
|
||||
# cloudflare Start
|
||||
set_real_ip_from 0.0.0.0/0;
|
||||
real_ip_header X-Forwarded-For;
|
||||
real_ip_recursive on;
|
||||
# cloudflare END
|
||||
```
|
||||
|
||||
|
||||
142
doc/install.md
142
doc/install.md
@ -1,142 +0,0 @@
|
||||
### Installation Instructions
|
||||
|
||||
#### Prerequisites
|
||||
- MySQL 5.7+ (recommended: 8.0)
|
||||
- Redis 6.0+ (recommended: 7.0)
|
||||
|
||||
#### Binary Installation
|
||||
|
||||
1. Determine your system architecture and download the corresponding binary file.
|
||||
|
||||
Download URL: `https://github.com/perfect-panel/server/releases`
|
||||
|
||||
Example setup: OS: Linux amd64, User: root, Current directory: `/root`
|
||||
|
||||
- Download the binary file:
|
||||
|
||||
```shell
|
||||
$ wget https://github.com/perfect-panel/server/releases/download/v1.0.0/ppanel-server-linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
- Extract the binary file:
|
||||
|
||||
```shell
|
||||
$ tar -zxvf ppanel-server-linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
- Navigate to the extracted directory:
|
||||
|
||||
```shell
|
||||
$ cd ppanel-server-linux-amd64
|
||||
```
|
||||
|
||||
- Grant execution permissions to the binary:
|
||||
|
||||
```shell
|
||||
$ chmod +x ppanel
|
||||
```
|
||||
|
||||
- Create a systemd service file:
|
||||
|
||||
```shell
|
||||
$ cat > /etc/systemd/system/ppanel.service <<EOF
|
||||
[Unit]
|
||||
Description=PPANEL Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/root/ppanel-server-linux-amd64/ppanel
|
||||
Restart=always
|
||||
User=root
|
||||
WorkingDirectory=/root/ppanel-server-linux-amd64
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
```
|
||||
|
||||
- Reload the systemd service configuration:
|
||||
|
||||
```shell
|
||||
$ systemctl daemon-reload
|
||||
```
|
||||
- Start the service:
|
||||
|
||||
```shell
|
||||
$ systemctl start ppanel
|
||||
```
|
||||
|
||||
#### Additional Notes
|
||||
|
||||
1. Installation Path: The binary files will be extracted to /root/ppanel-server-linux-amd64.
|
||||
|
||||
2. systemd Service:
|
||||
- Service Name: ppanel
|
||||
|
||||
- Service Configuration File: /etc/systemd/system/ppanel.service
|
||||
|
||||
- Service Commands:
|
||||
|
||||
- Start: systemctl start ppanel
|
||||
|
||||
- Stop: systemctl stop ppanel
|
||||
|
||||
- Restart: systemctl restart ppanel
|
||||
|
||||
- Status: systemctl status ppanel
|
||||
|
||||
- Enable on Boot: systemctl enable ppanel
|
||||
|
||||
3. Enable Auto-start: Use the following command to enable the service on boot:
|
||||
```shell
|
||||
$ systemctl enable ppanel
|
||||
```
|
||||
4. Service Logs: By default, logs are output to `/root/ppanel-server-linux-amd64/ppanel.log`.
|
||||
|
||||
5. You can view service logs using: `journalctl -u ppanel -f`
|
||||
6. If the configuration file is missing or empty, the service will start with default settings. The configuration file path is `./etc/ppanel.yaml`. Access `http://<server_address>:8080/init` to **initialize the system configuration**.
|
||||
|
||||
#### NGINX Reverse Proxy Configuration
|
||||
|
||||
Below is an example configuration to proxy the ppanel service to the domain api.ppanel.dev:
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name ppanel.dev;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
|
||||
# Set Nginx Cache
|
||||
set $static_file_cache 0;
|
||||
if ($uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$") {
|
||||
set $static_file_cache 1;
|
||||
expires 1m;
|
||||
}
|
||||
if ($static_file_cache = 0) {
|
||||
add_header Cache-Control no-cache;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If using Cloudflare as a proxy service, you need to retrieve the user's real IP address. Add the following to the http section of the NGINX configuration file:
|
||||
|
||||
- Dependency: `ngx_http_realip_module`. Check if your NGINX build includes this module by running `nginx -V`. If not, you will need to recompile NGINX with this module.
|
||||
|
||||
```nginx
|
||||
# Cloudflare Start
|
||||
set_real_ip_from 0.0.0.0/0;
|
||||
real_ip_header X-Forwarded-For;
|
||||
real_ip_recursive on;
|
||||
# Cloudflare End
|
||||
```
|
||||
Loading…
x
Reference in New Issue
Block a user