From Zero to a Live Cloud Server

Buy the instance, secure it, install Docker, point your domain at it — the exact ordered steps from console to a live service.

BeginnerUpdated 2026-10-2941K views

Buying the right thing

  • Region: pick the region physically closest to your users (Beijing/Shanghai/Guangzhou for their respective demographics)
  • Image: Ubuntu 22.04/24.04 LTS or your team's familiar RHEL-family; LTS saves you upgrade churn
  • Disk: 40-60GB system SSD is enough for most API servers; data goes on a separately mounted data disk or cloud DB
  • Bandwidth: 1-5Mbps fixed for start; scale up or switch to traffic billing once you have numbers
Two resources people regret skimping on: memory (OOM-kill under load, JVM especially) and bandwidth (a single image-heavy page can saturate 1Mbps in a second).

First-hour hardening

The order matters: new cloud IPs are scanned within minutes. Do the hardening before deploying anything.

# 1. 用 SSH 密钥登录、禁掉密码登录(控制台先绑定公钥)
ssh-keygen -t ed25519 -C 'me@laptop'
ssh-copy-id -i ~/.ssh/id_ed25519.pub ubuntu@1.2.3.4

# 2. 改 SSH 端口 + 只允许密钥
sudo sed -i 's/^#Port 22/Port 22960/' /etc/ssh/sshd_config
sudo sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
sudo systemctl restart sshd

# 3. 防火墙只放最小集合
sudo ufw default deny incoming
sudo ufw allow 22960/tcp
sudo ufw allow 80,443/tcp
sudo ufw enable

# 4. 自动安全更新(Ubuntu/Debian)
sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades

# 5. 非root日常用户 + sudo
sudo adduser deploy && sudo usermod -aG sudo deploy
  • Cloud security group = outer firewall; ufw/iptables = in-host firewall — configure BOTH
  • Fail2ban for SSH brute force: it costs nothing and stops weeks-long credential stuffing
  • Never expose MySQL/Redis ports to 0.0.0.0 — bind to 127.0.0.1 or keep them in the VPC

Domain, filing (备案) and DNS

CaseNeed ICP filingNotes
域名指向国内云服务器(80/443 web)必须未备案会被服务商随时拦截、存在关站风险
只做 API/非 80 端口(1.2.3.4:8080)仍需备案(运营商/不影响端口服务也称需)实务上无备案 80/443 才被拦,但建议备
域名解析到海外服务器不需要但国内访问速度/合规另有成本
只买域名不做站不需要建议持有后即备(以免后续麻烦)
If your site serves HTTP on 80/443 from a Chinese mainland server without an ICP filing, the provider will block it sooner or later. Budget 1-3 weeks for filing and do it before launch, not after.
# DNS 解析记录类型速记
A      example.com        → 1.2.3.4            (IPv4)
AAAA   example.com        → 2606:4700::...      (IPv6)
CNAME  www.example.com    → example.com.       (别名跳转)
MX     example.com        → mail provider       (邮件交换)
TXT    _dnsauth.example   → key-1234            (域名所有权验证)

Daily ops: monitoring, snapshots, backups

A server without monitoring and backups is a time bomb. Install the basics the same day you launch.

# 1. 云厂商监控插件+告警(控制台一键装 agent)
#    最低限度告警:CPU>80% 持续5分钟、内存>85%、磁盘>90%、带宽>阈值

# 2. 定时快照策略(控制台配,每天凌晨自动快照,保留7天)

# 3. 应用层备份脚本(crontab -e)
0 3 * * *  /opt/backup/pg_dump.sh >> /var/log/backup.log 2>&1

# 4. 检查备份真的能恢复:每季度做一次恢复演练
An unverified backup is a hypothesis. Periodically restore a snapshot/backup to a scratch instance and actually start the service against it — this is the only proof that counts when production dies at 3am.

Friends & Partners