linux服务器部署ghost
# 安装docker
#rocky linux执行:
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
#把软件仓库地址替换为 TUNA:
sudo sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum install docker-ce
#**启动**
systemctl start docker
systemctl enable docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
# docker compose部署ghost
version: '3'
services:
ghost:
image: ghost:5.104.2-alpine
restart: always
ports:
- 2368:2368
environment:
# Ghost 数据库配置
- database__client=mysql
- database__connection__host=mysql
- database__connection__user=ghost
- database__connection__password=202dsf343
- database__connection__database=ghost
- NODE_ENV=production
- url=http://192.168.153.134:2368
depends_on:
- mysql
networks:
- ghost_network
mysql:
image: mysql:8.0.39
restart: always
environment:
- MYSQL_ROOT_PASSWORD=202dsf343
- MYSQL_DATABASE=ghost
- MYSQL_USER=ghost
- MYSQL_PASSWORD=202dsf343
volumes:
- ./mysql-data:/var/lib/mysql
networks:
- ghost_network
networks:
ghost_network:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
启动
docker compose up -d
# 访问web
http://192.168.153.134:2368/
后台:Ghost Admin (opens new window)
# casper主题优化
# 1、主题选择
点击后台设置,选择casper主题
# 2、修改导航栏
去掉sign in和订阅
将Subscription access改成nobody
# 3、修改首页横幅内容
# 4、修改footer底部页面内容
/var/lib/ghost/content/themes/casper/default.hbs
搜索footer,将下面内容注释掉或者删除,删掉重启服务:docker restart ghost-ghost-1
注意先备份
<footer class="site-footer outer">
<div class="inner">
<section class="copyright"><a href="{{@site.url}}">{{@site.title}}</a> © {{date format="YYYY"}}</section>
<nav class="site-footer-nav">
{{navigation type="secondary"}}
</nav>
<div class="gh-powered-by"><a href="https://ghost.org/" target="_blank" rel="noopener">Powered by Ghost</a></div>
</div>
</footer>
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
登录后台页面,点击代码注入,点击site footer
<footer class="site-footer custom-footer">
<div class="footer-container">
<div class="footer-content">
<div class="footer-section">
<h4>关于我们</h4>
<p>这里是网站简介</p>
</div>
<div class="footer-section">
<h4>联系方式</h4>
<p>邮箱:example@email.com</p>
<p>电话:123-456-7890</p>
</div>
<div class="footer-section">
<h4>友情链接</h4>
<a href="#">链接1</a>
<a href="#">链接2</a>
</div>
</div>
<div class="footer-bottom">
<p>© {{date format="YYYY"}} 您的网站名称. 版权所有.</p>
</div>
</div>
</footer>
<style>
.custom-footer {
background-color: #5a5454;
padding: 20px 0;
text-align: center;
}
.footer-container {
max-width: 1200px;
margin: 0 auto;
}
.footer-content {
display: flex;
justify-content: space-around;
}
.footer-section {
flex: 1;
margin: 0 15px;
}
.footer-bottom {
margin-top: 20px;
border-top: 1px solid #ddd;
padding-top: 10px;
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 5、添加文章内容
点击后台的Posts->Published
# 6、效果展示
上次更新: 2024/12/30, 14:46:54