Prerequisites
- A Zerops account (sign up if you don’t have one)
- A project in Zerops (create one in the GUI if needed)
- Static files to deploy (HTML, CSS, JS) or a framework that builds to static files
Step 1: Create Static Service
- Using GUI
- Using zCLI
- Go to your project dashboard in Zerops
- Click Add new service
- Select Static as the service type
- Set a unique hostname (e.g.,
app,web,site) - Configure scaling settings (optional)
- Click Create service
Step 2: Configure Your Application
Create azerops.yaml file in your repository root.
- Simple Static Files
- With Build Step
- With Custom Routing
If you have pre-built static files:That’s it! This minimal configuration:
zerops.yaml
- Serves your static files
- Handles SPA routing automatically
- Uses sensible defaults
Deploy your files using
zcli push from your project directory.Step 3: Deploy
- From Git Repository
- Using zCLI
- Go to your service in Zerops GUI
- Click Connect to GitHub/GitLab
- Authorize and select your repository
- Choose the branch
- Enable Deploy on push for automatic deployments
- Click Deploy
Step 4: Set Up Public Access
- Navigate to your service in Zerops GUI
- Go to Public access & routing
- Click Add new routing rule
- Choose:
- Zerops subdomain (e.g.,
myapp.zerops.app), or - Custom domain (requires DNS configuration)
- Zerops subdomain (e.g.,
- Save the routing rule
Common Examples
React Application
zerops.yaml
Vue Application with Custom Redirects
zerops.yaml
Gatsby Site with SEO
zerops.yaml
Multi-Domain Landing Pages
zerops.yaml
Routing Patterns
Masked Redirects
Show content from one URL while keeping another URL in the browser:No status code means it’s a masked redirect. Perfect for URL aliases.
Path Preservation
Maintain the path when redirecting:Domain Redirects
SEO Optimization
Enable Prerender.io for search engine visibility:- Sign up for Prerender.io
- In Zerops GUI, add secret variable:
- Name:
PRERENDER_TOKEN - Value: Your Prerender.io token
- Name:
- (Optional) Set custom host in
zerops.yaml:
Prerender automatically detects crawlers from Google, Bing, social media platforms, and AI tools (ChatGPT, Perplexity, Claude).
Security Headers
Add security headers for production:Troubleshooting
404 on page refresh (SPA routing)
404 on page refresh (SPA routing)
The Static service handles this automatically. If you’re getting 404s:
- Check that you have an
index.htmlin your root - Verify your
deployFilespath is correct - Make sure you haven’t overridden the default routing
CORS errors
CORS errors
Add CORS configuration:
Redirect not working
Redirect not working
Check:
- Status code is required for absolute URLs
- Path preservation needs trailing
/in target - Exact matches take priority over wildcards
- Review logs in Zerops GUI for errors
Build files not found
Build files not found
Verify your framework’s output directory matches
deployFiles:- React:
build/(Create React App) ordist/(Vite) - Vue:
dist/ - Angular:
dist/<project-name>/ - Next.js:
.next/(static export)
Custom headers not applied
Custom headers not applied
Remember to quote header values:
- Correct:
X-Frame-Options: "'DENY'" - Wrong:
X-Frame-Options: DENY
Migration from Full Nginx
If you’re migrating from a full Nginx service:- Review your current Nginx configuration
- Map Nginx directives to Static service YAML:
try_files→ Built-in default behaviorrewrite→routing.redirectsadd_headerfor CORS →routing.cors- Other headers →
routing.headers
- Test thoroughly in a development environment
- Deploy to production
Next Steps
Advanced Routing
Learn complex routing patterns
Framework Examples
See framework-specific guides
Custom Headers
Set up security headers
Environment Variables
Configure environment variables