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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
月光博客
月光博客
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Jina AI
Jina AI
小众软件
小众软件
U
Unit 42
云风的 BLOG
云风的 BLOG
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
宝玉的分享
宝玉的分享
B
Blog
C
Check Point Blog
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
量子位
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell

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
How to deploy Next.js app to Hostinger shared hosting and...
Abdulsalam A · 2026-05-20 · via DEV Community
Cover image for How to deploy Next.js app to Hostinger shared hosting and alsoadd a github workflow (ci/cd)

Abdulsalam Abdulrahman (Amtech Digital)

How to deploy Next.js app to Hostinger shared hosting and alsoadd a github workflow (ci/cd)

You can bypass Hostinger's limitations entirely by building your application on GitHub Actions and automatically deploying the static files via FTP/SFTP. This means you do not need Node.js installed on your Hostinger account, and your local machine does not need to handle the build.

You can bypass Hostinger's limitations entirely by building your application on GitHub Actions and automatically deploying the static files via FTP/SFTP. This means you do not need Node.js installed on your Hostinger account, and your local machine does not need to handle the build.

📋 Prerequisites Before Setting Up

You must first change your Next.js project to static export mode so GitHub can build it into flat HTML/CSS/JS files.

  1. Open your next.config.mjs (or next.config.js) and add the export configuration:
   /** @type {import('next').NextConfig} */const nextConfig = {
     output: 'export',
     images: {
       unoptimized: true, // Required for static export
     },
   };
   export default nextConfig;

Enter fullscreen mode Exit fullscreen mode

Commit and push this change to your repository.


🔐 Step 1: Get FTP Credentials & Add to GitHub

GitHub needs permission to upload files to your Hostinger server.

  1. Log into your Hostinger hPanel.
  2. Navigate to Websites > Manage > Files > FTP Accounts.
  3. Note your FTP Host, FTP Username, and FTP Password.
  4. Go to your repository on GitHub.
  5. Click Settings > Secrets and variables > Actions > New repository secret.
  6. Create the following three secrets:
    • FTP_SERVER (Your Hostinger FTP Host)
    • FTP_USERNAME (Your Hostinger FTP Username)
    • FTP_PASSWORD (Your Hostinger FTP Password)

🚀 Step 2: Create the GitHub Actions Workflow

This workflow will trigger every time you push to your main branch. It spins up a temporary virtual environment, installs Node.js, builds your Next.js app, and uploads the out folder to Hostinger.

  1. In the root of your local project, create a folder structure named .github/workflows/.
  2. Inside that folder, create a file named deploy.yml.
  3. Paste the following configuration into deploy.yml:
name: Deploy Next.js to Hostinger
on:
  push:
    branches:
      - main # Change this to 'master' if your default branch is named master
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-level: 20
          cache: 'npm'

      - name: Install Dependencies
        run: npm ci

      - name: Build Next.js Static Site
        run: npm run build

      - name: Deploy via FTP to Hostinger
        uses: SamKirkland/FTP-Deploy-Action@v4.3.5
        with:
          server: ${{ secrets.FTP_SERVER }}
          username: ${{ secrets.FTP_USERNAME }}
          password: ${{ secrets.FTP_PASSWORD }}
          local-dir: ./out/
          server-dir: ./public_html/ 
          # Use ./public_html/subfolder/ if hosting on a subdomain

Enter fullscreen mode Exit fullscreen mode


🛠️ Step 3: Trigger Your First Deployment

  1. Save the deploy.yml file.
  2. Commit and push the new workflow to GitHub:
   git add .github/workflows/deploy.yml next.config.mjs
   git commit -m "Add GitHub Actions CI/CD deployment workflow"
   git push origin main

Enter fullscreen mode Exit fullscreen mode

Go to the Actions tab on your GitHub repository page to watch the live build progress. Once it finishes green, your site will be updated live on Hostinger.

If you hit any errors during the automated GitHub build or face issues with asset loading, let me know the error message or if you are hosting this on a subdomain so we can tweak the routing configuration.