Loading...
Compact VPS reference card for Linux server setup, SSH, Docker, networking, security, monitoring, deployments, and maintenance on Ubuntu-based VPS environments.
| Term | Purpose |
|---|---|
VPS | Virtual private Linux server |
SSH | Remote shell access |
Nginx | Reverse proxy + web server |
Docker | Container runtime |
systemd | Linux service manager |
UFW | Ubuntu firewall utility |
ssh root@SERVER_IP
adduser deploy
usermod -aG sudo deploy
passwd deploy
hostnamectl set-hostname app-server
apt update && apt upgrade -y
timedatectl set-timezone Asia/Kolkata
reboot
| Command | Description |
|---|---|
ssh user@ip | Connect to server |
ssh-keygen -t ed25519 | Generate SSH key |
ssh-copy-id user@ip | Copy public key |
scp file user@ip:/path | Upload file |
rsync -avz ./ user@ip:/app | Sync directory |
nano ~/.ssh/authorized_keys
sudo nano /etc/ssh/sshd_config
sudo systemctl restart ssh
ufw allow OpenSSH
ufw allow 80
ufw allow 443
ufw enable
ufw status
apt install fail2ban -y
systemctl enable fail2ban
systemctl start fail2ban
| File | Purpose |
|---|---|
/etc/ufw/ | Firewall config |
/etc/fail2ban/ | Ban rules |
/var/log/auth.log | Login logs |
| Command | Description |
|---|---|
docker ps | Running containers |
docker images | List images |
docker logs app | View logs |
docker exec -it app sh | Open shell |
docker system prune | Cleanup |
docker build -t app .
docker run -d -p 3000:3000 app
docker compose up -d
docker compose down
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:3000;
}
}
ln -s /etc/nginx/sites-available/app \
/etc/nginx/sites-enabled/
nginx -t
systemctl restart nginx
| Path | Purpose |
|---|---|
/etc/nginx/sites-available/ | Site configs |
/var/log/nginx/ | Nginx logs |
apt install certbot python3-certbot-nginx -y
certbot --nginx -d example.com
certbot renew --dry-run
systemctl status certbot.timer
| Port | Usage |
|---|---|
80 | HTTP |
443 | HTTPS |
22 | SSH |
| Command | Description |
|---|---|
htop | Process monitor |
df -h | Disk usage |
free -m | Memory usage |
journalctl -u app | Service logs |
docker stats | Container metrics |
tail -f /var/log/nginx/access.log
tail -f /var/log/nginx/error.log
systemctl start app
systemctl stop app
systemctl restart app
systemctl status app
systemctl enable app
# /etc/systemd/system/app.service
[Service]
ExecStart=/usr/bin/node server.js
Restart=always
User=deploy
git pull origin main
npm install
npm run build
pm2 restart app
docker compose pull
docker compose up -d --build
| Tool | Usage |
|---|---|
PM2 | Node.js process manager |
GitHub Actions | CI/CD |
Docker Compose | Multi-container apps |
rsync | Fast deploy sync |