Skip to main content

🌐 How to Point a GoDaddy Subdomain to Your VPS (With Nginx + SSL)

🌐 How to Point a GoDaddy Subdomain to Your VPS (With Nginx + SSL)

Hosting your app on a VPS is a great step toward full control and performance. If you’ve already deployed your app (like a Next.js app) on a VPS and want to connect it to a subdomain like abhinav.rohatech.site, here’s a complete guide to help you get it done.


🔧 Step 1: Add a Subdomain in GoDaddy DNS

  1. Log in to GoDaddy and go to your domain dashboard (e.g., rohatech.site).
  2. Click DNS or "Manage DNS".
  3. Scroll down and click Add under DNS Records.

Add the following A record:

Type Name Value TTL
A abhinav Your VPS IP address 1 Hour

This points abhinav.rohatech.site to your VPS server.


🖥️ Step 2: Configure Nginx on Your VPS

SSH into your VPS server and create a new Nginx configuration file for your subdomain:

nano /etc/nginx/conf.d/abhinav.rohatech.site.conf

Paste the following Nginx configuration:

server {
    listen 80;
    server_name abhinav.rohatech.site;

    location / {
        proxy_pass http://localhost:3000;  # Adjust if your app runs on a different port
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Then test and reload Nginx:

nginx -t
systemctl restart nginx

🔐 Step 3: Add Free SSL with Let's Encrypt

To secure your subdomain with HTTPS, use Certbot:


dnf install epel-release -y
dnf install certbot python3-certbot-nginx -y
certbot --nginx -d abhinav.rohatech.site

Follow the prompts to install the SSL certificate.

🔁 Optional: Force HTTPS Redirect

If you want to automatically redirect all HTTP traffic to HTTPS, update your Nginx config:

server {
    listen 80;
    server_name abhinav.rohatech.site;
    return 301 https://$host$request_uri;
}

⏳ Step 4: Wait for DNS Propagation

It may take anywhere from 5 minutes to 1 hour for DNS changes to take effect globally. You can check with:


✅ Your Subdomain Is Now Live!

Once the DNS has propagated and Nginx is properly configured, visiting https://abhinav.rohatech.site will show your deployed app from your VPS.


💡 Tips

  • Use pm2 to manage your app process on the server
  • Place environment variables in a .env.production file
  • Use pm2 save and pm2 startup to keep your app running after reboot
  • Secure your server with a firewall (like firewalld or ufw)

Enjoy your powerful, subdomain-powered deployment! 🚀

Comments

Popular posts from this blog

DevOps Best Practices

 # DevOps Best Practices: Your Ultimate Guide to Modern Software Development In today's fast-paced tech world, DevOps isn't just a buzzword – it's a game-changer. Let's dive into the essential practices that can transform your software development process. ![DevOps Lifecycle](https://blogger.googleusercontent.com/img/placeholder.png) ## 🔄 1. Continuous Integration (CI) - The Foundation Think of CI as your code's quality guardian. Every time developers push code, automated tests run to catch issues early. Here's what makes great CI: - Automated builds triggered with every commit - Comprehensive test suites running automatically - Code quality checks integrated into the pipeline - Quick feedback loops to developers **Pro Tip:** Start with simple automated tests and gradually build up your test suite. Remember, it's better to have a few reliable tests than many unreliable ones. ## 🚀 2. Continuous Delivery (CD) - From Code to Customer CD ensures your software ...

Introduction to Cloud Computing: Revolutionizing the Digital Landscape

In today's rapidly evolving digital world, cloud computing stands as a cornerstone of modern technology, transforming how businesses operate and individuals interact with data. Let's dive deep into this fascinating technology that powers our digital future. ## What is Cloud Computing? Imagine having a virtual supercomputer at your fingertips, accessible from anywhere in the world. That's the essence of cloud computing – a technology that delivers computing services such as storage, databases, software, and processing power over the internet, eliminating the need for physical hardware investments. ## The Three Pillars of Cloud Service Models ### Infrastructure as a Service (IaaS) Think of IaaS as renting the digital building blocks of computing. Companies like Amazon Web Services (AWS) and Microsoft Azure provide virtual machines, storage, and networking resources on-demand. This model offers unprecedented flexibility, allowing businesses to scale their infrastructure up or ...

How to Fix "ERESOLVE Unable to Resolve Dependency Tree" Error While Creating a React App

How to Fix Dependency Errors While Creating a React App If you're trying to set up a React app using npx create-react-app and encounter the following error: npm error code ERESOLVE npm error ERESOLVE unable to resolve dependency tree npm error Found: react@19.0.0 npm error Could not resolve dependency: npm error peer react@"^18.0.0" from @testing-library/react@13.4.0 Don't worry! This issue occurs due to dependency conflicts between react , react-dom , and other packages like @testing-library/react . Below are two simple ways to fix this issue. Step 1: Try Fixing It With npm Before switching to Yarn, you can resolve the issue by installing the missing or incompatible dependencies manually. Here's how: After running npx create-react-app my-app , if the error appears, navigate to your project folder: cd my-app Install the missing web-vitals dependency: npm install web-vitals Check for other dependency ...