0% found this document useful (0 votes)
19 views

Setup NodeJS Hostinger Vite React

This document provides a step-by-step guide for setting up Node.js on Hostinger and deploying a Vite + React website. It includes instructions for enabling Node.js, uploading the project via Git or File Manager, installing dependencies, serving the app, and configuring the domain and SSL. Finally, it guides users on how to access their live website after deployment.

Uploaded by

ANIK DUTTA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Setup NodeJS Hostinger Vite React

This document provides a step-by-step guide for setting up Node.js on Hostinger and deploying a Vite + React website. It includes instructions for enabling Node.js, uploading the project via Git or File Manager, installing dependencies, serving the app, and configuring the domain and SSL. Finally, it guides users on how to access their live website after deployment.

Uploaded by

ANIK DUTTA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Setup Node.

js on Hostinger and Deploy Vite + React Website

1. Set Up Node.js on Hostinger

Step 1: Access Hostinger hPanel

Log in to your Hostinger account.


Go to Hosting > Manage for your selected domain.

Step 2: Enable Node.js

In the Advanced section, find Node.js.


Click Create a Node.js App.
Choose the Node.js version (latest stable recommended).
Set the Application Mode to Production.
Set the Application Root (e.g., public_html/my-app).
Set the Application URL (e.g., https://yourdomain.com).
Click Create.

2. Deploy Your Vite + React Website

Step 3: Upload Your Project

Option 1: Using Git


- Go to hPanel > Git.
- Clone your project repository:
git clone https://github.com/yourusername/yourrepo.git my-app
- Navigate to the project folder:
cd my-app

Option 2: Using File Manager


- Zip your Vite project (dist folder included).
- Upload it to public_html using File Manager.

3. Install Dependencies & Build

Open Terminal (or use SSH).


Navigate to your project directory:
cd ~/public_html/my-app
Install dependencies:
npm install
Build the project:
npm run build
This will generate a dist folder.

4. Serve the React App

Option 1: Using Express.js


- Create a server.js file:
(Code provided in the guide)
- Install Express:
npm install express
- Run the server:
node server.js

Option 2: Using Hostinger's Built-in Static Hosting


- Move dist to public_html
- Set Application Root: public_html
- Start Command: npx serve -s dist

5. Set Up Process Manager (Optional)

Install PM2 to keep the app running:


npm install -g pm2
pm2 start server.js
pm2 save
pm2 startup

6. Configure Domain & SSL

Go to Domains > Manage.


Set the root directory to public_html/my-app/dist.
Enable SSL for HTTPS.

7. Access Your Website

Open https://yourdomain.com to see your Vite + React app live.

You might also like