How to host a static site on your own server
A static site needs no runtime. Zefily serves its files with the web server, with HTTPS and browser caching. Deploy from a Git repository, or upload a ZIP for each release if you build the files elsewhere.
Before you start
- A server connected to Zefily with the web stack installed.
- The built files of the site (HTML, CSS, JavaScript and images) in a folder or repository.
- A domain whose DNS points to the server.
Steps
-
1. Build the site
Generate the final files, so the repository or ZIP holds the HTML, CSS, JavaScript and images the browser will load, not the source only.
-
2. Add the site
Choose Sites, then Add site, pick Static files as the site type and enter the domain with HTTPS on.
-
3. Connect Git or upload a ZIP
For Git, set up a Git deploy on the Deploy pane and choose the Static preset. Without Git, choose Upload ZIP on the Deploy pane; the archive can be up to 1 GB, and a single top folder inside it is removed.
-
4. Set the build commands if you need them
If the files come out of a build step, enter the build commands on the Deploy pane before the first deploy.
-
5. Add your own error pages
Put your 404.html and the other error pages in the web root. Zefily serves them for 403, 404, 500, 502, 503 and 504 when the web server produces the error.
-
6. Deploy or upload
Click Deploy now, or upload the ZIP. Each deploy unpacks the files into a new release folder and makes it live.
-
7. Check the caching
Zefily sends 30-day browser caching for static files. When a file changes, give it a new name, for example app.3f2a.css, so visitors fetch the new version at once.
Verify it works
Open the domain: index.html loads over HTTPS with a valid certificate. A page that does not exist shows your 404 page, and a request for a hidden file such as .env is refused.
Troubleshooting
- Visitors still see the old CSS
- Browsers keep static files for up to 30 days. Give the changed file a new name, or add a version to its address.
- A page address returns 404
- A static site serves files, not routes. Each page needs its own file, such as about/index.html for /about.
- The ZIP upload is refused
- The archive is checked on the server: it may not hold paths that leave the release, or links. Create the ZIP again from the build folder.
Questions
Do I need Node.js for a static site?
No. A static site runs without a runtime. Install Node.js only for an app that needs a server process.
Can I use my own domain?
Yes, and you should for production. Addresses under zefily.app are for trials.
Does it get HTTPS?
Yes, with HTTPS on, Zefily requests the certificate for the domain. See the HTTPS and certificates page in the docs for DNS validation.
Read next
Start on a server you own
Create your account, connect a server and follow the guide. The server stays yours: you pay your provider.