VPS 初始化配置清单

每次拿到新 VPS 都要做一遍同样的事,整理成清单备用。 1. 更换 root 密码 拿到机器第一件事: passwd 2. 更新系统 # Debian/Ubuntu apt update && apt upgrade -y # 安装常用工具 apt install -y curl wget git vim htop ufw fail2ban 3. 创建普通用户 不要直接用 root 操作: adduser waawo usermod -aG sudo waawo # 切换到新用户 su - waawo 4. 配置 SSH 密钥登录 在本机生成密钥(如果还没有的话): ssh-keygen -t ed25519 -C "your@email.com" 把公钥上传到服务器: ssh-copy-id waawo@your-server-ip 或者手动复制 ~/.ssh/id_ed25519.pub 内容到服务器的 ~/.ssh/authorized_keys。 5. 禁用 SSH 密码登录 确认密钥登录正常后,再修改 /etc/ssh/sshd_config: ...

March 30, 2026 · 1 min · waawo

Nginx 配置笔记

Nginx 配置写多了有些细节总记不住,统一整理在这里。 安装 # Debian/Ubuntu sudo apt install nginx # Arch Linux sudo pacman -S nginx # 启动 sudo systemctl enable --now nginx 配置文件结构 /etc/nginx/ ├── nginx.conf # 主配置文件 ├── conf.d/ # 通常在这里放站点配置 └── sites-enabled/ # 部分发行版用这个目录 nginx.conf 主体结构: worker_processes auto; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; include conf.d/*.conf; } 静态站点 server { listen 80; server_name example.com; root /var/www/html; index index.html; location / { try_files $uri $uri/ =404; } } HTTPS 配置 有了证书之后: ...

February 22, 2026 · 2 min · waawo