Deploy a Web App on Hostinger with Namecheap DNS and SSL

by Fahim

Deploying a web app to Hostinger when your domain is on Namecheap usually goes wrong in one of three ways: your SSL cert fails to issue, your custom domain emails suddenly stop working, or you stare at a 503 error because your app couldn’t bind to Hostinger’s assigned port. Here is how I wire up a Node.js app on Hostinger, route Namecheap DNS cleanly without breaking existing records, and get Let’s Encrypt SSL running on HTTPS.

I recently moved a client dashboard from a local staging container over to Hostinger Cloud. The deployment took about fifteen minutes once I stopped messing with full nameserver delegation and just handled routing directly at the DNS record level.

Deploy a Web App on Hostinger with Namecheap DNS and SSL
Deploy a Web App on Hostinger with Namecheap DNS and SSL

1. Preparing the Web App for Production

Before touching hPanel, make sure your app handles dynamic environment ports and reverse proxy headers. If you hardcode localhost:3000 or skip listening on process.env.PORT, Hostinger’s LiteSpeed/Nginx reverse proxy will instantly return a 503 Service Unavailable error.

Here is a basic Express setup (server.js) configured to read the assigned port and trust upstream proxy headers:

const express = require('express');
const path = require('path'); const app = express();
const PORT = process.env.PORT || 3000; // Trust reverse proxy headers from Hostinger edge
app.enable('trust proxy'); // Basic security headers
app.use((req, res, next) => { res.setHeader('X-Content-Type-Options', 'nosniff'); res.setHeader('X-Frame-Options', 'DENY'); next();
}); // Serve static build files
app.use(express.static(path.join(__dirname, 'public'))); app.get('/api/health', (req, res) => { res.status(200).json({ status: 'online', timestamp: new Date().toISOString(), uptime: process.uptime() });
}); app.listen(PORT, () => { console.log(`Server listening on port ${PORT}`);
});

Check that your package.json includes an explicit start script. Hostinger’s built-in Node manager looks for this command when launching your app.

{ "name": "my-web-app", "version": "1.0.0", "main": "server.js", "scripts": { "start": "node server.js" }, "dependencies": { "express": "^4.19.2" }
}

2. Setting Up the Application on Hostinger

Log in to hPanel and head to your hosting plan. If you’re deploying a Node app, open Node.js under the Advanced menu, or create a new slot under Websites > Add Website.

  1. Pick Other or Custom Web App during setup.
  2. Enter your domain name registered at Namecheap (e.g., example.com).
  3. Grab the Account IP Address from your hPanel dashboard sidebar (e.g., 195.35.12.84). You’ll need this for your Namecheap DNS records.

Now pull your app files onto the server. You can upload an archive via the File Manager or SSH directly into your account and clone the repo:

ssh u123456789@195.35.12.84 -p 65002
cd domains/example.com/public_html
git clone https://github.com/your-username/my-web-app.git .
npm install --production

In hPanel’s Node.js manager, set the Application root to /domains/example.com/public_html, select your runtime (I stick with v18 or v20 LTS per the Node.js documentation), and set server.js as your startup file. Click Save & Start.

3. Configuring Namecheap DNS Records

You have two ways to connect Namecheap to Hostinger: update your nameservers entirely or leave Namecheap BasicDNS alone and add custom host records. Stick with Namecheap BasicDNS if you have active email services or TXT verification tags tied to the domain—changing nameservers will break them instantly.

If you’re worried about breaking an active inbox, read our walkthrough on how to point Namecheap DNS to Hostinger without breaking email before editing records.

In Namecheap, go to your Domain List, click Manage next to your domain, and open the Advanced DNS tab.

  1. Under Host Records, remove any default parking pages or old server IPs.
  2. Add an A Record with Host: @, Value: YOUR_HOSTINGER_IP, and set TTL: Automatic (or 5 min while testing). If you need a refresher on record syntax, check the Namecheap DNS host record guide.
  3. Add a CNAME Record with Host: www, Value: example.com. (replace with your root domain), and TTL: Automatic.

If you prefer placing an edge proxy between Namecheap and Hostinger to cache static assets, you can follow our guide on how to connect a Namecheap domain to Hostinger through StackPath CDN.

# Namecheap Advanced DNS Host Records Configuration
Type Host Value TTL
A @ 195.35.12.84 300
CNAME www example.com. 300

Before requesting an SSL certificate, check that your new DNS records have actually propagated:

dig +short example.com @8.8.8.8
dig +short www.example.com @8.8.8.8

Once dig returns your Hostinger IP address, you’re clear to set up SSL.

4. Provisioning and Enforcing Let’s Encrypt SSL

Hostinger provides free Let’s Encrypt certificates directly inside hPanel. Do not trigger the install until your DNS records point to Hostinger—if the ACME challenge hits the old IP, validation fails and you’ll have to wait out a cooldown.

Once the DNS resolves to your Hostinger IP, go to Security > SSL in hPanel:

  1. Select your domain from the list.
  2. Click Install SSL. Hostinger will run the automated validation challenge following standard Let’s Encrypt validation protocols.
  3. Turn Force HTTPS on to redirect all standard HTTP traffic to port 443.

If you’re running a custom Node setup where hPanel’s default toggle doesn’t catch traffic, enforce HTTPS at the web server layer with a root .htaccess file:

 RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
  Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

The Strict-Transport-Security (HSTS) header tells browsers to strictly require HTTPS on all future visits, as detailed on MDN Web Docs.

5. Environment Variables and Process Management

Never commit raw API keys or database strings into your repo. Create an uncommitted .env file directly in your app root on Hostinger:

NODE_ENV=production
PORT=3000
DATABASE_URL=mysql://u123456_app:SecretPassword@127.0.0.1:3306/u123456_db
SESSION_SECRET=c8f5e1739f4e24618e7e221d604b120f

If your project runs alongside PHP workers or microservices, keep an eye on resource caps. Check out our guide on how to increase PHP memory limit on Hostinger if you run into memory exhaustion on hybrid stacks.

To make sure your Node app survives crashes and server reboots, run it under PM2 using an ecosystem.config.js file:

module.exports = { apps: [ { name: 'web-app', script: './server.js', instances: 1, autorestart: true, watch: false, max_memory_restart: '300M', env: { NODE_ENV: 'production' } } ]
};

Start the process and save the PM2 state from your terminal:

pm2 start ecosystem.config.js
pm2 save

6. Troubleshooting Common Deployment and DNS Errors

A few common hiccups I ran into during setup and how to get past them:

Error 1: SSL Installation Fails with ‘Domain not pointing to Hostinger’

Namecheap DNS changes usually take between 5 and 30 minutes to propagate. If hPanel errors out, query Namecheap’s authoritative nameservers directly to see what they’re serving:

# Query Namecheap authoritative nameserver directly
dig @dns1.registrar-servers.com example.com A

If Namecheap returns your Hostinger IP, retry the SSL setup inside hPanel. It should validate right away.

Error 2: 503 Service Unavailable or Cannot GET /

This means Hostinger’s reverse proxy can’t reach your Node instance. Pull your latest runtime logs to see what died:

tail -n 50 domains/example.com/logs/error.log

The usual culprit is either a missing dependency (run npm install in your app directory) or a hardcoded port ignoring process.env.PORT.

Error 3: Missing DNS Records for Email Delivery

Changing your domain’s A record won’t alter your MX records, but accidental overrides in Namecheap can break incoming mail. If messages bounce or head to spam, read our guide to configure SPF, DKIM, and DMARC records in Namecheap DNS.

Frequently Asked Questions

Should I use Namecheap BasicDNS or switch nameservers to Hostinger?

Stick with Namecheap BasicDNS if you have external mail servers (like Google Workspace), custom subdomains, or third-party verification tags. Only switch to Hostinger nameservers (ns1.dns-parking.com and ns2.dns-parking.com) if you want to manage all DNS records entirely inside hPanel.

How do I deploy updates when I push code to GitHub?

You can set up a simple GitHub Action with SSH credentials to pull changes and restart the process: git pull && npm install --production && pm2 reload web-app.

Why does my SSL show as insecure on mobile networks?

This almost always points to mixed content warnings or a broken certificate chain. Make sure all client-side scripts, stylesheets, and images load via relative paths or explicit https:// endpoints.

Can I run multiple web apps on different subdomains?

Yes. Create a new subdomain in hPanel, then add a matching A Record or CNAME in Namecheap Advanced DNS pointing to your Hostinger server IP. Hostinger’s vhost configuration routes requests to the right directory.

all_in_one_marketing_tool