Use your own domain name like myapp.com instead of a ClodHost subdomain. Includes DNS setup and free SSL.
When someone types your domain in their browser, here's what happens:
So you need to tell DNS to point your domain to your ClodHost server's IP address.
If you don't have a domain yet, here are some popular registrars:
| Registrar | Price (.com/year) | Notes |
|---|---|---|
| Namecheap | $10-13 | Free privacy protection, good interface |
| Cloudflare | $9-10 | At-cost pricing, includes CDN |
| Google Domains | $12 | Simple, integrates with Google |
| Porkbun | $9-10 | Cheap, free WHOIS privacy |
Cloudflare Registrar is great if you want CDN/caching features. Namecheap or Porkbun are good budget options.
Point your domain to your ClodHost server.
# Find your server's public IP
curl ifconfig.me
# Or check ClodHost dashboard for your server's IP
Go to your domain registrar's DNS settings and add these records:
| Type | Name | Value | TTL |
|---|---|---|---|
| A | @ | 123.45.67.89 (your server IP) | 3600 |
| A | www | 123.45.67.89 (your server IP) | 3600 |
DNS changes can take anywhere from a few minutes to 48 hours to propagate worldwide. If it doesn't work immediately, wait a few hours and try again.
# Check A record
dig myapp.com +short
# Should return your server's IP address
# 123.45.67.89
# Check www subdomain
dig www.myapp.com +short
HTTPS is essential for security and SEO. Let's get a free SSL certificate from Let's Encrypt.
# Install Certbot
sudo apt install certbot python3-certbot-nginx -y
# Get certificate (Certbot will auto-configure Nginx)
sudo certbot --nginx -d myapp.com -d www.myapp.com
# Follow the prompts:
# - Enter email for renewal notifications
# - Agree to terms
# - Choose to redirect HTTP to HTTPS (recommended)
# Test auto-renewal
sudo certbot renew --dry-run
Certbot automatically sets up a cron job to renew certificates before they expire. You don't need to do anything!
Choose one canonical version (with or without www) and redirect the other.
# /etc/nginx/sites-available/myapp
# Redirect www to non-www
server {
listen 80;
listen 443 ssl;
server_name www.myapp.com;
ssl_certificate /etc/letsencrypt/live/myapp.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myapp.com/privkey.pem;
return 301 https://myapp.com$request_uri;
}
# Main server block
server {
listen 443 ssl;
server_name myapp.com;
ssl_certificate /etc/letsencrypt/live/myapp.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myapp.com/privkey.pem;
root /var/www/myapp;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
Create subdomains like api.myapp.com or blog.myapp.com.
# 1. Add DNS record
# Type: A, Name: api, Value: your-server-ip
# 2. Get SSL for subdomain
sudo certbot --nginx -d api.myapp.com
# 3. Configure Nginx
server {
listen 443 ssl;
server_name api.myapp.com;
ssl_certificate /etc/letsencrypt/live/api.myapp.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.myapp.com/privkey.pem;
location / {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# Check DNS
dig myapp.com +short
nslookup myapp.com
# Test Nginx config
sudo nginx -t
# Check Nginx is running
sudo systemctl status nginx
# View Nginx error log
sudo tail -f /var/log/nginx/error.log
# Check SSL certificate
sudo certbot certificates
# Test SSL connection
openssl s_client -connect myapp.com:443 -servername myapp.com