How to Set Up a New Server Instance and connect a to domain name
Step 1: Create a New Server Instance
- Choose a cloud provider (AWS, DigitalOcean, Google Cloud, etc.).
- Launch a virtual server (instance) this configuration for ubuntu/ linux based but the process is almost same and there few changes according tot he environment
- Copy the public IP address — this is how you’ll access your server online.
Step 2: Install a Web Server (Nginx or Apache)
- Connect to your server via SSH.
- Install one of the following:
- Nginx:
sudo apt install nginx
- Apache:
sudo apt install apache2
Step 3: Test Server with IP Address
- Open a browser.
- Enter your server’s public IP.
- You should see a default welcome page (Nginx or Apache) — this confirms the server is active.
Step 4: Point Your Domain to the Server
- Log into your domain provider’s dashboard.
- Go to DNS settings.
- Add an A record:
- Host:
@
- Points to: Your public IP
- TTL: Automatic or 3600 seconds
DNS vs. Nameservers
- DNS Records connect your domain name to your server’s IP.
- Nameservers decide where DNS is managed (usually your domain provider unless using services like Cloudflare).
👉 Read our full blog on DNS vs Nameservers here that shows understanding between DNS and nameservers also how to configure it
Configure Your Server to Host a Website
Step 5: Configure Nginx to Serve Your Website
-
Navigate to the Nginx configuration directory:
bash cd /etc/nginx/sites-available/ sudo nano example.com
-
Add the following configuration to the file:
nginx
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
Step 6: Enable the Site
- Create your website directory:
bash
sudo mkdir -p /var/www/example.com
sudo chown -R $USER:$USER /var/www/example.com
-
Add a basic
index.html
file inside that folder. -
Enable your site by linking it to the
sites-enabled
directory:
bash
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Step 7: Check If Domain Is Pointed Correctly
- Use the
ping
command to test your domain:
bash
ping example.com
* If it returns your server’s IP address, your domain is correctly pointed.
Step 8: Secure Your Website with an SSL Certificate
- Install Certbot for Nginx:
bash
sudo apt install certbot python3-certbot-nginx
- Run Certbot to automatically configure SSL:
bash
sudo certbot --nginx -d example.com -d www.example.com
- This enables HTTPS (port 443) and redirects all HTTP traffic to HTTPS.
Final Step: Deploy Your Application
-
Your server is now ready to host any application (Python, Node.js, etc.).
-
Upload your code or application files to:
/var/www/example.com
- Nginx will serve your app through your custom domain securely.