Virtual Hosts
The sites: section defines virtual hosts, allowing you to serve different content based on the Host header of incoming requests. This works like Nginx server_name blocks.
Site Types
Each site must specify exactly one of the following types:
| Type | Value | Description |
|---|---|---|
dir |
Folder path | Serve static files or a Node.js project from a folder |
proxy |
URL | Forward requests to another HTTP server |
Node.js Detection
When a dir site's folder contains a package.json, it is treated as a Node.js project:
- If
server.jsexists, it runs as a backend handler. - If only
package.jsonexists (noserver.js), the plugin attempts to build the project (e.g., React/Vue SPA).
Domain Matching
| Domain Value | Behavior |
|---|---|
"example.com" |
Match requests with Host: example.com (or example.com:port) |
"" (empty) |
Catch-all / default. Matches any domain not explicitly listed |
The catch-all site must be listed with domain: "". If no catch-all is defined, unmatched domains receive a 404 response.
Optional Per-Site Settings
ssl— SSL certificate for HTTPS on this domainrate-limit— Rate limit for requests to this site
Examples
Simple Static Site
sites:
- domain: "example.com"
dir: "site/example"
Serves files from plugins/ZyveraWeb/site/example/ when the Host header is example.com.
Multiple Domains, Different Types
sites:
- domain: "example.com"
dir: "site/main"
- domain: "api.example.com"
proxy: "http://localhost:3000"
- domain: "blog.example.com"
dir: "site/blog"
- domain: ""
dir: "site/fallback"
Site with SSL
sites:
- domain: "example.com"
dir: "site/secure"
ssl:
cert: fullchain.pem
key: privkey.pem
Node.js + Static Fallthrough
sites:
- domain: "app.example.com"
dir: "site/myapp"
For Node.js sites, the handler first checks for a matching file in public/. If none is found, it calls server.js. If server.js returns null, a 404 is returned.
Folder Conventions
- Web folders are relative to
plugins/ZyveraWeb/. - Site folders are under
plugins/ZyveraWeb/site/<name>/. - Node.js projects should contain a
public/folder for static assets and optionally aserver.jsfile for backend logic.
No comments to display
No comments to display