Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Q
qiyouxue
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xuchentao
qiyouxue
Commits
424c9f87
Commit
424c9f87
authored
Aug 14, 2026
by
tao355667
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: adapt deployment for new server
parent
22513c25
Pipeline
#467
passed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
34 deletions
+16
-34
.gitlab-ci.yml
.gitlab-ci.yml
+10
-8
CMS_README.md
CMS_README.md
+1
-1
README.md
README.md
+1
-1
qiyouxue.conf
deploy/nginx/qiyouxue.conf
+4
-24
No files found.
.gitlab-ci.yml
View file @
424c9f87
...
@@ -13,10 +13,10 @@ variables:
...
@@ -13,10 +13,10 @@ variables:
DEPLOY_LOCK
:
"
/root/qiyouxue/shared/deploy.lock"
DEPLOY_LOCK
:
"
/root/qiyouxue/shared/deploy.lock"
APP_NAME
:
"
qiyouxue"
APP_NAME
:
"
qiyouxue"
SITE_URL
:
"
http://127.0.0.1:8793/"
SITE_URL
:
"
http://127.0.0.1:8793/"
PM2_BIN
:
"
/usr/bin/pm2"
PUBLIC_URL
:
"
http://127.0.0.1/"
PM2_BIN
:
"
/root/.nvm/versions/node/v20.20.2/bin/pm2"
PM2_HOME_DIR
:
"
/root/.pm2"
PM2_HOME_DIR
:
"
/root/.pm2"
PM2_USE_SUDO
:
"
1"
PM2_USE_SUDO
:
"
0"
PUBLIC_HOST
:
"
qiyouxueedu.com"
stages
:
stages
:
-
deploy
-
deploy
...
@@ -45,6 +45,7 @@ deploy:
...
@@ -45,6 +45,7 @@ deploy:
/*) ;;
/*) ;;
*) echo "PM2_HOME_DIR 必须是绝对路径" >&2; exit 2 ;;
*) echo "PM2_HOME_DIR 必须是绝对路径" >&2; exit 2 ;;
esac
esac
export PATH="$(dirname "$PM2_BIN"):$PATH"
if [ "$CURRENT_DIR" != "$DEPLOY_ROOT/current" ] || [ "$SHARED_DIR" != "$DEPLOY_ROOT/shared" ]; then
if [ "$CURRENT_DIR" != "$DEPLOY_ROOT/current" ] || [ "$SHARED_DIR" != "$DEPLOY_ROOT/shared" ]; then
echo "current 或 shared 目录不属于部署根目录" >&2
echo "current 或 shared 目录不属于部署根目录" >&2
exit 2
exit 2
...
@@ -176,11 +177,12 @@ deploy:
...
@@ -176,11 +177,12 @@ deploy:
test -f "$CURRENT_DIR/deploy/nginx/qiyouxue.conf" || (echo "缺少 Nginx 配置" >&2 && exit 2)
test -f "$CURRENT_DIR/deploy/nginx/qiyouxue.conf" || (echo "缺少 Nginx 配置" >&2 && exit 2)
sudo -n /usr/bin/install -o root -g root -m 0644 "$CURRENT_DIR/deploy/nginx/qiyouxue.conf" /etc/nginx/conf.d/qiyouxue.conf
sudo -n /usr/bin/install -o root -g root -m 0644 "$CURRENT_DIR/deploy/nginx/qiyouxue.conf" /etc/nginx/conf.d/qiyouxue.conf
sudo -n /usr/sbin/nginx -t
sudo -n /usr/sbin/nginx -t
sudo -n /usr/bin/systemctl reload nginx
if sudo -n /usr/bin/systemctl is-active --quiet nginx; then
curl --fail --silent --show-error --max-time 5 \
sudo -n /usr/bin/systemctl reload nginx
--noproxy "*" \
else
--resolve "$PUBLIC_HOST:443:127.0.0.1" \
sudo -n /usr/bin/systemctl enable --now nginx
"https://$PUBLIC_HOST/" >/dev/null
fi
curl --fail --silent --show-error --max-time 5 "$PUBLIC_URL" >/dev/null
echo "[deploy] 部署完成:$CURRENT_DIR"
echo "[deploy] 部署完成:$CURRENT_DIR"
echo "[deploy] 旧 releases 目录未被读取或清理;确认无用后请人工删除"
echo "[deploy] 旧 releases 目录未被读取或清理;确认无用后请人工删除"
CMS_README.md
View file @
424c9f87
...
@@ -80,6 +80,6 @@ Word 导入示例字段:
...
@@ -80,6 +80,6 @@ Word 导入示例字段:
-
PM2 应用名:
`qiyouxue`
-
PM2 应用名:
`qiyouxue`
-
服务端口:
`8793`
-
服务端口:
`8793`
-
Nginx 配置:
`/etc/nginx/conf.d/qiyouxue.conf`
-
Nginx 配置:
`/etc/nginx/conf.d/qiyouxue.conf`
-
公网域名:
`qiyouxueedu.com`
-
临时公网入口:服务器 IP 的 HTTP 80 端口
Runner 需具备安装固定 Nginx 配置、执行
`nginx -t`
与 reload 的最小 sudo 权限。生产密钥、上传文件、CMS 数据、构建锁与内容写锁必须位于
`shared/`
。建议内容写锁放在
`CMS_DATA_DIR`
内,确保所有 Node 进程看到同一锁文件。
Runner 需具备安装固定 Nginx 配置、执行
`nginx -t`
与 reload 的最小 sudo 权限。生产密钥、上传文件、CMS 数据、构建锁与内容写锁必须位于
`shared/`
。建议内容写锁放在
`CMS_DATA_DIR`
内,确保所有 Node 进程看到同一锁文件。
README.md
View file @
424c9f87
...
@@ -50,7 +50,7 @@ npm start
...
@@ -50,7 +50,7 @@ npm start
-
Nginx 配置:
`deploy/nginx/qiyouxue.conf`
-
Nginx 配置:
`deploy/nginx/qiyouxue.conf`
-
生产端口:
`8793`
-
生产端口:
`8793`
-
站点域名:
`qiyouxueedu.com`
-
临时公网入口:服务器 IP 的 HTTP 80 端口
-
服务器目录:
`/root/qiyouxue/current`
与
`/root/qiyouxue/shared`
-
服务器目录:
`/root/qiyouxue/current`
与
`/root/qiyouxue/shared`
生产部署前需在
`/root/qiyouxue/shared/.env`
配置独立的
`CMS_PASSWORD`
、
`CMS_SECRET`
、
`CMS_API_KEY`
、
`CMS_DATA_DIR`
、
`CMS_BUILD_LOCK`
和
`CMS_CONTENT_LOCK`
。构建锁只保护部署时的
`dist/`
替换;内容锁只保护 CMS 的 Markdown 与分类写入,两者不要共用路径。
生产部署前需在
`/root/qiyouxue/shared/.env`
配置独立的
`CMS_PASSWORD`
、
`CMS_SECRET`
、
`CMS_API_KEY`
、
`CMS_DATA_DIR`
、
`CMS_BUILD_LOCK`
和
`CMS_CONTENT_LOCK`
。构建锁只保护部署时的
`dist/`
替换;内容锁只保护 CMS 的 Markdown 与分类写入,两者不要共用路径。
deploy/nginx/qiyouxue.conf
View file @
424c9f87
# 启优学官网:
HTTP 统一跳转至 HTTPS 主域名
。
# 启优学官网:
域名和 HTTPS 启用前,暂时通过 80 端口提供服务
。
server
{
server
{
listen
80
;
listen
80
default_server
;
server_name
qiyouxueedu
.
com
www
.
qiyouxueedu
.
com
;
listen
[::]:
80
default_server
;
return
301
https
://
qiyouxueedu
.
com
$
request_uri
;
server_name
""
;
}
server
{
listen
443
ssl
http2
;
server_name
www
.
qiyouxueedu
.
com
;
ssl_certificate
/
etc
/
nginx
/
certs
/
qiyouxueedu
.
com
.
fullchain
.
pem
;
ssl_certificate_key
/
etc
/
nginx
/
certs
/
qiyouxueedu
.
com
.
certkey
.
pem
;
ssl_protocols
TLSv1
.
2
TLSv1
.
3
;
return
301
https
://
qiyouxueedu
.
com
$
request_uri
;
}
server
{
listen
443
ssl
http2
;
server_name
qiyouxueedu
.
com
;
ssl_certificate
/
etc
/
nginx
/
certs
/
qiyouxueedu
.
com
.
fullchain
.
pem
;
ssl_certificate_key
/
etc
/
nginx
/
certs
/
qiyouxueedu
.
com
.
certkey
.
pem
;
ssl_protocols
TLSv1
.
2
TLSv1
.
3
;
ssl_session_cache
shared
:
QIYOUXUE
:
10
m
;
ssl_session_timeout
1
d
;
ssl_session_tickets
off
;
client_max_body_size
28
m
;
client_max_body_size
28
m
;
location
/ {
location
/ {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment