Host on other platforms
Upload your exported Bevel site to Netlify, Cloudflare Pages, Azure Static Web Apps, S3, nginx, or run the ASP.NET Core app itself.
On this page
Every static host needs the same three facts from you:
- The output folder. Upload what
--bevel-buildwrote (for exampledist). - The base path. Set BevelOptions.PathBase only if the site is not at the domain root.
- A 404 page. Map
/404.htmland tell the host to serve it for unknown URLs.
dotnet run -c Release -- --bevel-build dist
On a static host, Bevel does not run. The host serves the files as they are, so set up 404 pages, fallbacks and redirects in the host's settings.
Pick your host
- Build command:
dotnet run -c Release -- --bevel-build dist - Publish directory:
dist - Netlify serves a root
404.htmlfor unknown URLs by default. - Keep the path base empty unless you serve from a sub-path.
- Build command:
dotnet run -c Release -- --bevel-build dist - Build output directory:
dist - Cloudflare Pages serves a root
404.htmlwhen it exists. - Keep the path base empty on a project domain such as
your-project.pages.dev.
- App location: your project folder. Output location:
dist. Skip the host's own build, or give it a build step that runs the export. - Add a
staticwebapp.config.jsonfile for the 404 page:
{ "responseOverrides": { "404": { "rewrite": "/404.html" } } }
- Upload the folder:
aws s3 sync dist s3://your-bucket --delete - Turn on static website hosting. Set the index document to
index.htmland the error document to404.html. - Put a CDN in front to serve HTTPS. Redirect rules for directories belong to the CDN or bucket settings.
server {
listen 80;
root /var/www/mysite;
index index.html;
error_page 404 /404.html;
location / {
try_files $uri $uri/index.html $uri.html =404;
}
}
Choose an output style that matches the host
DirectoryIndex (default) writes about/index.html, and links look like /about. Most hosts serve that. If a host expects .html files, use FlatHtml (about.html, links like /about.html). See Choose an output style.
Host the ASP.NET Core app itself
Run the app instead of uploading files when the site lives next to live endpoints such as APIs or sign-in pages. Export first, then publish with the exported wwwroot:
dotnet run -c Release -- --bevel-build
dotnet publish -c Release
Or set <BevelExportOnPublish>true</BevelExportOnPublish> and run only dotnet publish. Run the published app as is.
- Run it in a non-Development environment. Bevel then serves the exported files, verified against
.bevel-output.json. - Set
PathBaseand callapp.UsePathBase(...)if the app sits under a sub-path behind a reverse proxy. - Map
/404.htmland callapp.UseStatusCodePagesWithReExecute("/404.html")for a custom 404 page. Status-code pages keep the original status. - Routes that need authorization are not exported unless you allow it, so they render live. See Authorization and exports.
How the app answers requests is covered in Development and production.