## 1. 反向代理
```
location / {
proxy_pass http://127.0.0.1:8080;
rewrite ^/(.*)$ /$1 break;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade-Insecure-Requests 1;
proxy_set_header X-Forwarded-Proto https;
}
```
## 2. Hexo博客的Front-matter
```yaml
---
title:
date:
categories:
-
tags:
-
-
index_img:
sticky:
---
```
## 3. Ubuntu 20.04 Debian 9/10 开启Google BBR
```
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
```
```
sysctl -p
```
```
sysctl net.ipv4.tcp_available_congestion_control
```
```
lsmod | grep bbr
```
## 4. Docker镜像加速器
```
{
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com",
"https://pec3hyiy.mirror.aliyuncs.com",
"https://registry.docker-cn.com"
]
}
```
## 5. Oracle Cloud开启root登录
1. 使用密钥登录系统以后
`sudo -i && vim /root/.ssh/authorized_keys`
2. 把ssh-rsa之前的内容都删除掉.
`vim /etc/ssh/sshd_config`
3. 找到PermitRootLogin, 把前面的#去掉
4. 更改为PermitRootLogin yes
5. 找到PasswordAuthentication
6. 更改为 PasswordAuthentication yes
7. 退出编辑
8. 更改密码
`passwd`
9. 重启vps
`reboot`
## 6. 升级VanBlog
1. 切换到部署 vanblog 的目录下(docker-compose.yml)存放的路径下
2. 关闭原有服务
`docker-compose down`
3. 删除原有镜像
`docker rmi mereith/van-blog:latest`
4. 重新拉取最新镜像
`docker pull mereith/van-blog:latest`
5. 重新启动服务
`docker-compose up -d`
## 7. 将docker run命令转换为docker-compose配置清单
- 转换工具:[Composerize](https://github.com/magicmark/composerize)
- 在线转换:[composerize](https://www.composerize.com/)
- docker run命令
```
docker run -dit --name searxng -v /root/searxng:/etc/searxng -e TZ=Asia/Shanghai -p 8180:8080 --hostname searxng --restart always searxng/searxng
```
```
docker run -dit \
--name searxng \
-v /root/searxng:/etc/searxng \
-e TZ=Asia/Shanghai \
-p 8180:8080 \
--hostname searxng \
--restart always \
searxng/searxng:latest
```
- ### docker-compose配置清单
```
version: '3.3'
services:
searxng:
container_name: searxng
volumes:
- '/root/searxng:/etc/searxng'
environment:
- TZ=Asia/Shanghai
ports:
- '8180:8080'
hostname: searxng
restart: always
image: searxng/searxng
```
## 8. 用Watchtower自动更新Docker镜像与容器
```
docker run -d \
--name watchtower \
--restart always \
-e TZ=Asia/Shanghai \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower \
--cleanup \
-s "0 0 6,12,18,22 * * *"
```
## 9. 页面上所有链接在新窗口中打开
```
W3School
```
## 10. 自定义网站favicon图标
- 将favicon.ico图标上传到网站根目录
- 在网站主页的和之间添加以下代码
```
```
版权归属:
李丰华
许可协议:
本文使用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》协议授权
评论区