Skip to content

PHP Host

How to Deploy an Astro Website to PHP Hosting

If you want to deploy your Blacks Astro JS project to PHP hosting — like cPanel, Plesk, or any shared hosting account — you can. Astro builds to static HTML, which works on any web host.

This guide walks you through the process.


PHP Hosting Deploy

Cpanel Plesk PHP astro js themes template


Step 1 — Build Production Mode

Access your Astro project from the terminal and run:

Terminal window
npm run build

This generates the dist folder — the production build of your site.

What’s inside dist/:

  • index.html — the homepage
  • Other .html files for each page
  • _astro/ folder with CSS and JavaScript
  • All your images and assets

This folder contains everything needed to serve your site.


Step 2 — Upload the dist Folder to Your PHP Host

Upload the contents of the dist folder to your hosting’s public directory.

For cPanel:

  1. Log in to cPanel
  2. Open File Manager
  3. Navigate to public_html/
  4. Upload the dist folder contents
  5. Extract the files if you uploaded a ZIP

For Plesk:

  1. Log in to Plesk
  2. Go to File Manager
  3. Navigate to httpdocs/
  4. Upload the dist folder contents
  5. Extract the files if you uploaded a ZIP

Important: Upload the contents of dist/, not the folder itself. The index.html file must sit at the root of public_html/ or httpdocs/.


Step 3 — Test Your Site

Open your browser and visit your domain:

https://yourdomain.com

Your Blacks site should be live.


Common File Manager Steps

Upload via File Manager

  1. Open File Manager in cPanel or Plesk
  2. Navigate to the public folder (public_html/ or httpdocs/)
  3. Click Upload
  4. Select your ZIP file
  5. Wait for the upload to complete
  6. Right-click the ZIP file → Extract
  7. Delete the ZIP file after extraction

Upload via FTP

If you prefer FTP:

  1. Connect to your host using an FTP client (FileZilla, WinSCP)
  2. Enter your FTP credentials (host, username, password)
  3. Navigate to public_html/ or httpdocs/
  4. Drag your dist/ folder contents into that directory

Enable SSL (HTTPS)

Most shared hosts include free SSL via Let’s Encrypt through AutoSSL.

cPanel:

  1. Search for SSL/TLS Status or AutoSSL
  2. Run AutoSSL for your domain
  3. Wait a few minutes for the certificate to be issued

Plesk:

  1. Go to Websites & Domains → your domain
  2. Click SSL/TLS Certificates
  3. Click Install next to Let’s Encrypt
  4. Enter your email and confirm

Once SSL is active, your site redirects from http:// to https:// automatically.


Build Settings Summary

SettingValue
Build commandnpm run build
Output directorydist
Upload location (cPanel)public_html/
Upload location (Plesk)httpdocs/

Troubleshooting

ProblemSolution
Default hosting page still showingWrong upload directory — check public_html/ or httpdocs/
403 ForbiddenSet folder permissions to 755 and files to 644
404 on subpagesVerify index.html exists at the root
CSS/JS not loadingCheck site URL in astro.config.mjs
Changes not showingHard refresh in your browser (Ctrl + Shift + R)
SSL not workingRun AutoSSL or install Let’s Encrypt manually

Why This Works

Astro builds to static HTML — no PHP, no database, no server-side code required. Your PHP host simply serves the files.

This means:

  • No database configuration needed
  • No PHP version conflicts
  • No server-side security concerns
  • Just upload and go

Next Step

Explore other hosting options:

👉 Cloudflare — free hosting with unlimited bandwidth