File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,5 +137,11 @@ $ZFILE_INSTALL_PATH/bin/start.sh # 启动
137137</TabItem >
138138</Tabs >
139139
140+ ## 配置开机自启 (systemd)
141+
142+ 如果你希望 ZFile 在服务器重启后自动启动,可以使用 ` systemd ` 来管理服务。参考:
143+
144+ [ 常见问题 - Linux 部署如何配置开机自启(systemd)] ( /question/systemd-config )
145+
140146## 帮我安装🔍
141147[ 技术支持] ( /support/ )
Original file line number Diff line number Diff line change @@ -140,5 +140,11 @@ $ZFILE_INSTALL_PATH/bin/start.sh # 启动
140140</TabItem >
141141</Tabs >
142142
143+ ## 配置开机自启 (systemd)
144+
145+ 如果你希望 ZFile 在服务器重启后自动启动,可以使用 ` systemd ` 来管理服务。参考:
146+
147+ [ 常见问题 - Linux 部署如何配置开机自启(systemd)] ( /question/systemd-config )
148+
143149## 帮我安装🔍
144150[ 技术支持] ( /support/ )
Original file line number Diff line number Diff line change 1+ import Tabs from ' @theme/Tabs' ;
2+ import TabItem from ' @theme/TabItem' ;
3+
4+ # Linux 部署如何配置开机自启(systemd)
5+
6+ 注意:以下配置仅适用于 ZFile 4.2.0 及以上版本,且以下是默认配置,若你修改了 zfile 的安装目录,请自行修改以下 ` WorkingDirectory ` 和 ` ExecStart ` 中的路径。
7+
8+ 1 . 添加以下内容到 ` /etc/systemd/system/zfile.service ` 文件中。
9+ <Tabs >
10+ <TabItem value = " os" label = " 开源版" >
11+ ``` bash
12+ [Unit]
13+ Description=ZFile Service
14+ Documentation=https://docs.zfile.vip
15+ After=network.target syslog.target
16+
17+ [Service]
18+
19+ # User=zfile
20+ # Group=zfile
21+
22+ Type=simple
23+ PrivateTmp=true
24+ LimitNOFILE=65536
25+ StandardOutput=journal
26+ StandardError=journal
27+
28+ WorkingDirectory=/root/zfile/
29+ ExecStart=/root/zfile/zfile/zfile --spring.config.location=/root/zfile/application.properties
30+ ExecReload=/bin/kill -HUP $MAINPID
31+
32+ SuccessExitStatus=143
33+ Restart=on-failure
34+ RestartSec=10s
35+
36+ [Install]
37+ WantedBy=multi-user.target
38+ ```
39+ </TabItem >
40+ <TabItem value = " pro" label = " 捐赠版" >
41+ ``` bash
42+ [Unit]
43+ Description=ZFile Service
44+ Documentation=https://docs.zfile.vip
45+ After=network.target syslog.target
46+
47+ [Service]
48+
49+ # User=zfile
50+ # Group=zfile
51+
52+ Type=simple
53+ PrivateTmp=true
54+ LimitNOFILE=65536
55+ StandardOutput=journal
56+ StandardError=journal
57+
58+ WorkingDirectory=/root/zfile-pro/
59+ ExecStart=/root/zfile-pro/zfile/zfile --spring.config.location=/root/zfile-pro/application.properties
60+ ExecReload=/bin/kill -HUP $MAINPID
61+
62+ SuccessExitStatus=143
63+ Restart=on-failure
64+ RestartSec=10s
65+
66+ [Install]
67+ WantedBy=multi-user.target
68+ ```
69+ </TabItem >
70+ </Tabs >
71+
72+ 2 . 使 systemd 生效并设置开机自启:
73+ ``` bash
74+ systemctl daemon-reload
75+ systemctl enable zfile
76+ ```
77+
78+ 3 . 启动 ZFile 服务:
79+ ``` bash
80+ systemctl start zfile
81+ ```
82+
83+ 其他命令
84+ ``` bash
85+ systemctl status zfile # 查看服务状态
86+ systemctl stop zfile # 停止服务
87+ systemctl restart zfile # 重启服务
88+ ```
Original file line number Diff line number Diff line change @@ -230,15 +230,30 @@ const sidebars = {
230230 label : '常见问题' ,
231231 items : [
232232 {
233- id : 'question/run-multiple-instance ' ,
233+ id : 'question/systemd-config ' ,
234234 type : 'doc' ,
235- label : '如何运行多个 ZFile 实例?'
235+ label : '如何配置开机自启(systemd)?'
236+ } ,
237+ {
238+ id : 'question/bind-domain' ,
239+ type : 'doc' ,
240+ label : '如何用域名访问?'
241+ } ,
242+ {
243+ id : 'question/start-fail' ,
244+ type : 'doc' ,
245+ label : '启动失败/无法访问怎么办?'
236246 } ,
237247 {
238248 id : 'question/update-config-file' ,
239249 type : 'doc' ,
240250 label : '如何修改配置文件?'
241251 } ,
252+ {
253+ id : 'question/run-multiple-instance' ,
254+ type : 'doc' ,
255+ label : '如何运行多个 ZFile 实例?'
256+ } ,
242257 {
243258 id : 'question/only-office-download-fail' ,
244259 type : 'doc' ,
@@ -254,16 +269,6 @@ const sidebars = {
254269 type : 'doc' ,
255270 label : '忘记管理员密码怎么办?'
256271 } ,
257- {
258- id : 'question/start-fail' ,
259- type : 'doc' ,
260- label : '启动失败/无法访问怎么办?'
261- } ,
262- {
263- id : 'question/bind-domain' ,
264- type : 'doc' ,
265- label : '如何用域名访问?'
266- } ,
267272 {
268273 id : 'question/cat-current-version' ,
269274 type : 'doc' ,
You can’t perform that action at this time.
0 commit comments