惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
K
Kaspersky official blog
Forbes - Security
Forbes - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Proofpoint News Feed
G
GRAHAM CLULEY
V
Vulnerabilities – Threatpost
Security Latest
Security Latest
Scott Helme
Scott Helme
S
Securelist
美团技术团队
T
Threat Research - Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
W
WeLiveSecurity
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
AI
AI
L
Lohrmann on Cybersecurity
S
Security Affairs
Cloudbric
Cloudbric
SecWiki News
SecWiki News
爱范儿
爱范儿
雷峰网
雷峰网
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
大猫的无限游戏
大猫的无限游戏
N
News and Events Feed by Topic
I
InfoQ
S
Secure Thoughts
AWS News Blog
AWS News Blog
A
About on SuperTechFans
Schneier on Security
Schneier on Security
酷 壳 – CoolShell
酷 壳 – CoolShell
The Last Watchdog
The Last Watchdog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Check Point Blog
P
Palo Alto Networks Blog
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Google DeepMind News
Google DeepMind News
Latest news
Latest news
I
Intezer
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
D
Docker

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How to Connect a Namecheap Domain to a DigitalOcean Droplet with Nginx
Tahsin Abrar · 2026-05-16 · via DEV Community

Buying a domain is exciting. Creating a server is exciting too.

But the moment you try to connect both of them, things can feel confusing.

You bought your domain from Namecheap. You created a VPS on DigitalOcean. Now you expect your website to open when someone visits your domain.

But unlike shared hosting or cPanel hosting, DigitalOcean does not automatically connect everything for you.

diagram

You need to set up two important things:

  1. DNS : so your domain points to your server
  2. Nginx : so your server knows how to serve your website

In this guide, we will walk through the full setup in a simple and beginner-friendly way.

By the end, your domain will point to your DigitalOcean Droplet, Nginx will serve your website, and HTTPS will be enabled.


The Big Picture

Before touching any settings, let’s understand the flow.

Namecheap Domain
        ↓
DNS points to DigitalOcean IP
        ↓
DigitalOcean Droplet
        ↓
Nginx Web Server
        ↓
Your Website

Enter fullscreen mode Exit fullscreen mode

Your domain is like a human-friendly address.

Your DigitalOcean Droplet is the actual server.

DNS connects the domain to the server.

Nginx receives the request and serves your website files or forwards traffic to your app.


Step 1: Create a DigitalOcean Droplet

First, create a Droplet on DigitalOcean.

For a beginner project or test website, this setup is usually enough:

Ubuntu 22.04 LTS
Basic Droplet
1 GB RAM

Enter fullscreen mode Exit fullscreen mode

After the Droplet is created, DigitalOcean will give you a public IP address.

It will look something like this:

159.89.xxx.xxx

Enter fullscreen mode Exit fullscreen mode

Keep this IP address safe. You will need it in the next step.

This IP is where your domain will point.


Step 2: Point Your Namecheap Domain to DigitalOcean

Now go to your Namecheap account.

Open:

Domain List
→ Manage
→ Advanced DNS

Enter fullscreen mode Exit fullscreen mode

There are two common ways to connect your domain.


Option A: Use A Records

This is the easiest method for beginners.

Add these DNS records:

Type Host Value
A Record @ Your DigitalOcean IP
A Record www Your DigitalOcean IP

Example:

Type Host Value
A Record @ 159.89.xxx.xxx
A Record www 159.89.xxx.xxx

You can keep TTL as the default value.

Here is what this does:

example.com       → DigitalOcean server
www.example.com   → DigitalOcean server

Enter fullscreen mode Exit fullscreen mode

So both the root domain and the www version will go to the same Droplet.

For most simple projects, this is the best starting point.


Option B: Use DigitalOcean Nameservers

Another option is to manage DNS from DigitalOcean instead of Namecheap.

In DigitalOcean, go to:

Networking
→ Domains
→ Add Domain

Enter fullscreen mode Exit fullscreen mode

Add your domain there.

DigitalOcean will give you nameservers like:

ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com

Enter fullscreen mode Exit fullscreen mode

Then go back to Namecheap:

Domain
→ Manage
→ Nameservers
→ Custom DNS

Enter fullscreen mode Exit fullscreen mode

Add those three DigitalOcean nameservers and save.

This method is useful when you want to manage all DNS records from DigitalOcean, especially if you have multiple subdomains or services.


Which DNS Method Should You Choose?

For beginners, use A Records.

It is simple, clear, and easy to debug.

Use DigitalOcean nameservers when your setup becomes larger, for example:

api.example.com
app.example.com
blog.example.com
admin.example.com

Enter fullscreen mode Exit fullscreen mode

For now, we will continue with the beginner-friendly A Record method.


Step 3: Wait for DNS Propagation

DNS changes are not always instant.

Sometimes they work in a few minutes. Sometimes they take longer.

Usually, it can take:

5 minutes to 1 hour

Enter fullscreen mode Exit fullscreen mode

In some cases, it may take up to:

24 hours

Enter fullscreen mode Exit fullscreen mode

You can use tools like DNS Checker to see whether your domain is pointing to the correct server IP.

A common beginner mistake is changing DNS and immediately thinking something is broken. Sometimes nothing is broken. DNS just needs a little time.


Step 4: Connect to Your Server with SSH

Now connect to your DigitalOcean Droplet.

On Mac or Linux, open your terminal.

On Windows, you can use PowerShell or PuTTY.

Run:

ssh root@YOUR_SERVER_IP

Enter fullscreen mode Exit fullscreen mode

Example:

ssh root@159.89.xxx.xxx

Enter fullscreen mode Exit fullscreen mode

The first time you connect, your terminal may ask for confirmation. Type:

yes

Enter fullscreen mode Exit fullscreen mode

Then enter your password or use your SSH key, depending on how you created the Droplet.


Step 5: Install Nginx

Once you are inside the server, update the package list:

sudo apt update

Enter fullscreen mode Exit fullscreen mode

Then install Nginx:

sudo apt install nginx -y

Enter fullscreen mode Exit fullscreen mode

Check if Nginx is running:

sudo systemctl status nginx

Enter fullscreen mode Exit fullscreen mode

If everything is working, you should see that Nginx is active.

At this point, if you open your server IP in the browser, you may see the default Nginx welcome page.

That means your web server is working.


Step 6: Configure the Firewall

Ubuntu servers often use ufw for firewall management.

Allow Nginx traffic:

sudo ufw allow 'Nginx Full'

Enter fullscreen mode Exit fullscreen mode

Also allow SSH so you do not lock yourself out:

sudo ufw allow OpenSSH

Enter fullscreen mode Exit fullscreen mode

Then enable the firewall:

sudo ufw enable

Enter fullscreen mode Exit fullscreen mode

You can check the firewall status with:

sudo ufw status

Enter fullscreen mode Exit fullscreen mode

You should see that HTTP, HTTPS, and SSH traffic are allowed.


Step 7: Create a Website Folder

Now create a folder for your website.

sudo mkdir -p /var/www/myproject

Enter fullscreen mode Exit fullscreen mode

Create a test HTML file:

sudo nano /var/www/myproject/index.html

Enter fullscreen mode Exit fullscreen mode

Paste this:

<h1>Hello from DigitalOcean</h1>

Enter fullscreen mode Exit fullscreen mode

Save the file:

CTRL + X
Y
Enter

Enter fullscreen mode Exit fullscreen mode

This simple file will help us confirm that the domain and Nginx setup are working.


Step 8: Create an Nginx Server Block

An Nginx server block tells Nginx how to handle traffic for a specific domain.

Create a new config file:

sudo nano /etc/nginx/sites-available/myproject

Enter fullscreen mode Exit fullscreen mode

Paste this configuration:

server {
    listen 80;
    server_name example.com www.example.com;

    root /var/www/myproject;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}

Enter fullscreen mode Exit fullscreen mode

Replace this:

example.com www.example.com

Enter fullscreen mode Exit fullscreen mode

With your real domain.

For example:

server_name mycoolsite.com www.mycoolsite.com;

Enter fullscreen mode Exit fullscreen mode

This config says:

“When someone visits this domain, serve files from /var/www/myproject.”


Step 9: Enable the Site

Nginx keeps available site configs in:

/etc/nginx/sites-available/

Enter fullscreen mode Exit fullscreen mode

But it only uses configs that are linked in:

/etc/nginx/sites-enabled/

Enter fullscreen mode Exit fullscreen mode

So we need to enable the site:

sudo ln -s /etc/nginx/sites-available/myproject /etc/nginx/sites-enabled/

Enter fullscreen mode Exit fullscreen mode


Step 10: Test and Reload Nginx

Before restarting Nginx, always test the config:

sudo nginx -t

Enter fullscreen mode Exit fullscreen mode

If everything is fine, you should see something like:

syntax is ok
test is successful

Enter fullscreen mode Exit fullscreen mode

Now reload Nginx:

sudo systemctl reload nginx

Enter fullscreen mode Exit fullscreen mode

Open your domain in the browser:

http://yourdomain.com

Enter fullscreen mode Exit fullscreen mode

You should see:

Hello from DigitalOcean

Enter fullscreen mode Exit fullscreen mode

Great. Your domain is now connected to your Droplet.


Step 11: Add HTTPS with Certbot

A production website should use HTTPS.

For that, we can use Certbot with Let’s Encrypt.

Install Certbot:

sudo apt install certbot python3-certbot-nginx -y

Enter fullscreen mode Exit fullscreen mode

Then run:

sudo certbot --nginx

Enter fullscreen mode Exit fullscreen mode

Certbot will ask you to choose the domain.

Select your domain and allow redirect to HTTPS.

After that, your site should work with:

https://yourdomain.com

Enter fullscreen mode Exit fullscreen mode

Certbot also sets up automatic renewal, so your SSL certificate can renew before it expires.


Final Architecture

Your setup now looks like this:

Namecheap
   ↓
DNS A Record
   ↓
DigitalOcean Droplet IP
   ↓
Nginx
   ↓
Website Files

Enter fullscreen mode Exit fullscreen mode

This is a common real-world setup used by many developers.


Why This Feels Different from cPanel Hosting

If you are coming from cPanel hosting, DigitalOcean may feel harder at first.

That is normal.

With cPanel hosting, the hosting company usually handles many things for you:

DNS
Apache or Nginx
SSL
PHP
File manager
Email tools

Enter fullscreen mode Exit fullscreen mode

You often just change nameservers and upload your files.

But with a DigitalOcean VPS, you manage the server yourself.

That means you are responsible for:

Nginx
Firewall
SSL
App runtime
Deployment
Security
Logs

Enter fullscreen mode Exit fullscreen mode

The benefit is flexibility.

You can run Node.js, Laravel, Docker, PostgreSQL, Redis, background workers, multiple apps, and more.

The tradeoff is that you need to understand the server setup.


A Real-Life Example

Imagine you built a small portfolio website.

You bought:

myportfolio.com

Enter fullscreen mode Exit fullscreen mode

from Namecheap.

Then you created a DigitalOcean Droplet with this IP:

159.89.100.50

Enter fullscreen mode Exit fullscreen mode

In Namecheap, you add:

Type Host Value
A Record @ 159.89.100.50
A Record www 159.89.100.50

Then on your server, your Nginx config looks like this:

server {
    listen 80;
    server_name myportfolio.com www.myportfolio.com;

    root /var/www/myportfolio;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}

Enter fullscreen mode Exit fullscreen mode

After reloading Nginx and setting up SSL, visitors can open:

https://myportfolio.com

Enter fullscreen mode Exit fullscreen mode

And see your website.

That is the full journey from domain to live website.