Hosting static sites and JavaScript framework builds

Deploy the output of Astro, Hugo, Eleventy, Jekyll, or a React, Vue or Next.js static export to Traxio, with routing rules for single-page apps.

How-to guideIntermediate2 min readUpdated

If your site builds to static files, you don’t need a Node.js app running on the server at all: upload the output and it’s served directly, which is the fastest option. (If you do need server-side Node.js, that’s supported too. Can I run Node.js, Python or Ruby apps on Traxio?)

1. Build locally

ToolCommandOutput folder
Vite (React, Vue, Svelte)npm run builddist/
Next.js with output: 'export'npm run buildout/
Astronpm run builddist/
Hugohugopublic/
Eleventynpx @11ty/eleventy_site/
Jekyllbundle exec jekyll build_site/

2. Upload the output

Upload the contents of the output folder to public_html — zip it, upload and extract. How to upload and extract a zip file

3. Single-page apps: route everything to index.html

Client-side routers (React Router, Vue Router) need the server to return index.html for paths like /dashboard. Add to public_html/.htaccess:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

Static site generators that create a real folder per page don’t need this.

4. Caching assets

Build tools add hashes to file names, so they can be cached for a long time:

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
</IfModule>

Forms and APIs

Static sites can call third-party APIs from the browser. For form handling or small server logic, a PHP script alongside the static files works fine. Sending email from your website reliably

New to Traxio? The PHP hosting page lists the PHP versions, database and tools every account gets, free for the first 30 days.

Popular

Tip: press / to search from any pageSee all results