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

Step 1 — Build Production Mode
Access your Astro project from the terminal and run:
npm run buildThis generates the dist folder — the production build of your site.
What’s inside dist/:
index.html— the homepage- Other
.htmlfiles 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:
- Log in to cPanel
- Open File Manager
- Navigate to
public_html/ - Upload the
distfolder contents - Extract the files if you uploaded a ZIP
For Plesk:
- Log in to Plesk
- Go to File Manager
- Navigate to
httpdocs/ - Upload the
distfolder contents - 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.comYour Blacks site should be live.
Common File Manager Steps
Upload via File Manager
- Open File Manager in cPanel or Plesk
- Navigate to the public folder (
public_html/orhttpdocs/) - Click Upload
- Select your ZIP file
- Wait for the upload to complete
- Right-click the ZIP file → Extract
- Delete the ZIP file after extraction
Upload via FTP
If you prefer FTP:
- Connect to your host using an FTP client (FileZilla, WinSCP)
- Enter your FTP credentials (host, username, password)
- Navigate to
public_html/orhttpdocs/ - Drag your
dist/folder contents into that directory
Enable SSL (HTTPS)
Most shared hosts include free SSL via Let’s Encrypt through AutoSSL.
cPanel:
- Search for SSL/TLS Status or AutoSSL
- Run AutoSSL for your domain
- Wait a few minutes for the certificate to be issued
Plesk:
- Go to Websites & Domains → your domain
- Click SSL/TLS Certificates
- Click Install next to Let’s Encrypt
- Enter your email and confirm
Once SSL is active, your site redirects from http:// to https:// automatically.
Build Settings Summary
| Setting | Value |
|---|---|
| Build command | npm run build |
| Output directory | dist |
| Upload location (cPanel) | public_html/ |
| Upload location (Plesk) | httpdocs/ |
Troubleshooting
| Problem | Solution |
|---|---|
| Default hosting page still showing | Wrong upload directory — check public_html/ or httpdocs/ |
| 403 Forbidden | Set folder permissions to 755 and files to 644 |
| 404 on subpages | Verify index.html exists at the root |
| CSS/JS not loading | Check site URL in astro.config.mjs |
| Changes not showing | Hard refresh in your browser (Ctrl + Shift + R) |
| SSL not working | Run 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