Deploy your Astro Site to Hostinger
Это содержимое пока не доступно на вашем языке.
Hostinger is a web hosting provider that supports static sites and Node.js applications.
This guide covers deploying both static and server-rendered Astro projects to Hostinger using hPanel.
Prerequisites
Section titled “Prerequisites”- A Hostinger account with an active hosting plan.
- Static site deployment is supported on all plans that include hPanel.
- Server-rendered deployment requires a plan that supports Node.js applications, such as Business Web Hosting or Cloud hosting.
- An Astro project ready to deploy.
Static site deployment
Section titled “Static site deployment”Astro projects use output: 'static' by default, so no additional configuration is required to deploy a static site.
You can upload the contents of your dist/ folder to Hostinger using either the hPanel File Manager or an FTP client.
File Manager upload
Section titled “File Manager upload”-
Build your Astro project locally:
Terminal window npm run buildTerminal window pnpm buildTerminal window yarn build -
Log in to hPanel and open your website.
-
Open Files > File Manager and navigate to the
public_htmldirectory. -
Upload the contents of your local
dist/folder intopublic_html. You can drag and drop files, or upload an archive and extract it in place. -
Visit your domain to confirm your site is live.
FTP upload
Section titled “FTP upload”-
In hPanel, go to Files > FTP Accounts to find or create your FTP credentials.
-
Connect to your hosting account using an FTP client such as FileZilla.
-
Upload the contents of your local
dist/folder to thepublic_htmldirectory on the server. -
Visit your domain to confirm your site is live.
Server-rendered deployment using Node.js
Section titled “Server-rendered deployment using Node.js”For on-demand rendering, deploy your Astro project as a Node.js application on a Hostinger plan that supports Node.js.
Add the Node.js adapter
Section titled “Add the Node.js adapter”Add the Node.js adapter to enable on-demand rendering with the following astro add command:
npx astro add nodepnpm astro add nodeyarn astro add nodeMake sure your package.json has a start script that runs the built server:
"scripts": { "start": "node ./dist/server/entry.mjs"}Deploy from a Git repository
Section titled “Deploy from a Git repository”-
Push your Astro project to a GitHub, GitLab, or Bitbucket repository.
-
Log in to hPanel and go to Websites.
-
Add a new website and select the Node.js application option.
-
Connect your Git provider and select your repository and branch.
-
Configure the build settings:
- Build command:
npm run build - Start command:
npm run start
- Build command:
-
Select a Node.js version that satisfies Astro’s minimum requirement (Node.js 22 or later).
-
Start the deployment. Hostinger will install dependencies, run your build command, and start the application.
Deploy by uploading project files
Section titled “Deploy by uploading project files”-
Build your Astro project locally, then upload the generated
dist/folder along withpackage.jsonand the lock file (e.g.package-lock.json). -
In hPanel, add a new website and select the Node.js application option.
-
Upload your project files (or a
.ziparchive) using the File Manager. -
Configure the application:
- Application root: the folder containing your
package.json. - Start command:
npm run start
- Application root: the folder containing your
-
Select a supported Node.js version and start the application.
Official resources
Section titled “Official resources”- Hostinger documentation — official help center for hPanel, hosting plans, and Node.js applications.