建站
本文为大家准备了一系列建站教程。
一、Nezha Server Monitoring 哪吒监控
开源、轻量、易用的服务器监控与运维工具
视频教程
请务必结合视频教程食用,因为细节内容都在视频中讲解,本文主要供小伙伴们拷贝代码用途。
哪吒面板
docker-compose配置文件
yml
services:
dashboard:
image: ghcr.io/nezhahq/nezha
container_name: nezha-dashboard
restart: always
volumes:
- ./data:/dashboard/data
ports:
- 8008:8008
面板配置文件
yml
debug: false
realipheader: ""
language: zh_CN
sitename: DigVPS.COM
jwtsecretkey: 75VV5b9jtTGCktY8XuoK0BhCp2hMcMEVP9XXk3WVUf0PEpyYvFUWOxXGczyWVDCvwUVvzusZL54AvZfdkjmzU45f1lJ64zjr0uNasJ8KsCDlHkQN3ODRstVojGC1S4WRcQb2S3BZj5mZVVRjb0GZZdmFybpmx7DSZJUtGIftkRmGvEywDTepUXEpysMaAulVrdkI920Zt7YZhkAdsc3qMw1hpUD6r8q0ERWugdkf1BjTBHFtHTYPka7lri7HQcdRRIB11f5pmbejjBtVwfzV4lM8eTaz0j0SwKMC2le3SejoriHvcH3sbnhfuGJY9ZfmJKnhACBllxt9NuQjDFcstLztNi79aT5wDsrwHmFS8N7CriXwhyR0DdFRQiitX0tWp4X7SLhYyiLuqGgq4bmNlIkGIKdmcFupDT3YA8Pi0qgVnPTFA2nCRyYfCgCkzRb7M4Gym9EaaSrp5gHJGo5uyOh81iXNkJSlyXH1kwc7MAqrLD5gq3jpSF54jciNy0yGtQTNCh98Nz3qeWGw9bT0lOAcSEtnZlvKNc4fvaBFU3c9Js1V4B1pTGFjdZJvVRaEuD065kkORtxR6eaKmo5NBv5qNk32lsxcCaOiuYNMCHFtGbUWGmCKct3rtk6kzh0lGfImYlHzo2xu0IiytAs11FDzUE7fT1yugf3wcJ2GboDol8r12anMgleHZevFx8LI9O3Gf3UgkbIaqHVYc7njTl41r489wte7vuXur2A0dyv5MSR8PJ0TeLdWsSbLVHxfkZ0yYM5HAChnGInCkkgPE3DFfG6ukjQmpu3m3KGK0JMfHqbg1XjA7gVVCFcImZ1iJSbhK77N17fkN8HErNt5Dbqp4tJ74RWy3N1bcKDki3YODeU64fQudHqv4U7EDpy3IIEBChGLXcXEl7ZkJDE7CmY5cbfCCA7zALHdcGVcCU3sW0l1B4coYRqYJPPA1nnLzUdZUwsJoT3GpkfOMdx9tgQcMZVuVDdmqjtbBpkZ1GsqftKY6D3DqavEcj2vjEqN
agentsecretkey: WYGjFRqQPhcBCfmfPoXMjXUNIanxceKw
listenport: 8008
listenhost: ""
installhost: DigVPS.COM #客户端需要连接的服务器域名或者IP,请改为你自己的。
tls: true
location: Asia/Shanghai
enableplainipinnotification: false
enableipchangenotification: false
ipchangenotificationgroupid: 0
cover: 1
ignoredipnotification: ""
ignoredipnotificationserverids: {}
avgpingcount: 2
dnsservers: ""
customcode: ""
customcodedashboard: ""
反代配置
underscores_in_headers on;
ignore_invalid_headers off;
location /dashboard {
proxy_pass http://$server:$port;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
}
# websocket 相关
location ~* ^/api/v1/ws/(server|terminal|file)(.*)$ {
proxy_set_header Host $host;
proxy_set_header nz-realip $remote_addr;
proxy_set_header Origin https://$host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_pass http://$server:$port;
}
# grpc 相关
location ^~ /proto.NezhaService/ {
grpc_set_header Host $host;
grpc_set_header nz-realip $remote_addr;
grpc_set_header client_secret $http_client_secret;
grpc_set_header client_uuid $http_client_uuid;
grpc_read_timeout 600s;
grpc_send_timeout 600s;
grpc_socket_keepalive on;
client_max_body_size 10m;
grpc_buffer_size 4m;
grpc_pass grpc://$server:$port;
}
延迟监控IP
地区 | 电信 | 移动 | 联通 | 教育 |
---|---|---|---|---|
上海 | 202.96.209.133 | 221.183.90.237 | 210.22.97.1 | 202.120.2.119 |
北京 | 49.7.37.74 | 112.34.111.194 | 111.206.209.44 | 101.6.15.66 |
广州 | 183.47.126.35 | 120.233.18.250 | 157.148.58.29 | 202.116.64.8 |
深圳 | 218.17.11.168 | 120.196.165.24 | 58.250.90.114 | |
河北 | 27.185.242.215 | 111.62.229.100 | 61.182.138.156 | |
山西 | 1.71.157.41 | 183.201.244.91 | 60.221.18.41 | |
辽宁 | 123.184.58.41 | 36.131.156.145 | 218.61.211.132 | |
吉林 | 123.172.127.217 | 111.27.127.176 | 122.143.8.41 | |
黑龙江 | 42.101.84.132 | 111.42.190.25 | 113.7.211.140 | |
江苏 | 58.215.210.220 | 36.156.92.132 | 122.96.235.165 | |
浙江 | 115.220.14.91 | 117.147.213.41 | 101.69.194.224 | |
安徽 | 223.247.108.251 | 112.29.198.100 | 112.132.208.41 | |
福建 | 106.126.10.28 | 112.50.96.88 | 36.248.48.139 | |
江西 | 106.227.22.132 | 117.168.150.249 | 116.153.69.224 | |
山东 | 144.123.160.140 | 120.220.145.91 | 112.240.56.143 | |
河南 | 171.15.110.220 | 111.7.99.220 | 123.6.65.101 | |
湖北 | 111.170.8.60 | 111.47.131.101 | 122.189.226.138 | |
湖南 | 113.240.117.108 | 120.226.192.91 | 116.162.28.220 | |
广东 | 183.36.23.111 | 183.240.65.191 | 112.90.211.100 | |
海南 | 124.225.43.220 | 111.29.29.219 | 153.0.226.35 | |
四川 | 118.123.218.220 | 183.220.151.41 | 101.206.163.49 | |
贵州 | 58.42.61.132 | 61.243.18.220 | 117.187.254.132 | |
云南 | 222.221.102.220 | 36.147.44.219 | 14.204.150.41 | |
陕西 | 124.115.14.100 | 111.19.148.100 | 123.139.127.132 | |
甘肃 | 118.182.228.91 | 117.157.16.41 | 59.81.94.53 | |
青海 | 223.221.216.219 | 111.12.152.170 | 116.177.237.137 | |
内蒙古 | 110.76.186.70 | 117.161.76.41 | 116.114.98.41 | |
广西 | 222.217.93.55 | 36.136.112.41 | 171.39.5.51 | |
西藏 | 113.62.176.89 | 117.180.234.41 | 43.242.165.35 | |
宁夏 | 222.75.44.220 | 111.51.155.214 | 116.129.226.28 | |
新疆 | 110.157.243.45 | 36.189.208.164 | 116.178.77.40 | |
天津 | 42.81.98.35 | 111.31.236.35 | 116.78.119.56 | |
重庆 | 119.84.131.101 | 221.178.81.101 | 221.7.92.98 |
二、Wallos 账单管理
开源的个人订阅跟踪器
视频教程
Docker 配置文件
docker-compose yaml
version: '3.0'
services:
wallos:
container_name: wallos
image: bellamy/wallos:latest
ports:
- "8282:80/tcp"
environment:
TZ: 'America/Toronto'
# Volumes store your data between container upgrades
volumes:
- './db:/var/www/html/db'
- './logos:/var/www/html/images/uploads/logos'
restart: unless-stopped
三、WordPress 部署教程
WordPress 站点部署教程涉及的技术栈:Docker、Nginx、MySQL、Redis、Cloudflare CDN
准备工作
更新系统软件源
terminal
apt update
创建 Swap 文件(可选)
terminal
# 查看目前使用情况
swapon --show
# 创建 Swap 文件
fallocate -l 2G /swapfile
# 设置权限
chmod 600 /swapfile
# 配置 Swap 空间
mkswap /swapfile
# 激活 Swap
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab
# 重启系统之后验证
swapon --show
free -mh
Swap 内核配置(可选)
/etc/sysctl.conf
# 编辑文件
# 如果是 Debian 13 请使用这个路径 /etc/sysctl.d/sysctl.conf
vi /etc/sysctl.conf
# 添加以下行
vm.swappiness=10
# 应用变动
sysctl --system
安装 Docker
请查看Nginx Proxy Manager 站点反代文档中的安装 Docker
章节。
WordPress 安装
Docker 容器配置文件
docker-compose.yml
services:
db:
image: mysql:5.7
volumes:
- './db_data:/var/lib/mysql'
restart: always
environment:
MYSQL_ROOT_PASSWORD: your_mysql_password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: your_wordpress_password
redis:
image: redis:latest
restart: always
entrypoint: redis-server --appendonly yes --requirepass your_redis_password --maxmemory 512mb --maxmemory-policy allkeys-lru
ports:
- "6379"
volumes:
- './redis_data:/data'
- '/etc/timezone:/etc/timezone:ro'
wordpress:
depends_on:
- db
- redis
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: your_wordpress_password
WORDPRESS_DB_NAME: wordpress
WORDPRESS_CONFIG_EXTRA: |
/* Redis configuration */
define('WP_REDIS_HOST','redis');
define('WP_REDIS_PORT','6379');
define('WP_REDIS_PASSWORD','your_redis_password');
define('WP_CACHE_KEY_SALT','your_salt_key');
define('WP_CACHE',true);
REDIS_HOST: redis
volumes:
- './wp_content:/var/www/html/wp-content'
nginx:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- wordpress
Nginx 配置文件
nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# Set the maximum allowed file size for uploads
client_max_body_size 10M;
server {
listen 80;
server_name domain.local;
location / {
proxy_pass http://wordpress:80;
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 X-Forwarded-Proto $scheme;
}
}
}
Cloudflare 配置
清除 DNS 缓存(可选)
# macOS
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
# Windows
ipconfig /flushdns