Nixpacks Staticfile provider configure NGINX for SPA
Anonymous
HOBBYOP

2 years ago

My project is a React Vite app with React Router. Railway gets just static file, built by my GitLab CI. They get recognized as the Nixpacks Staticfile type when I deploy them on Railway.

Now, how can I add an Nginx config that only adds SPA support. Meaning, all requests should be redirected to /index.html. This is the only configuration I want to do. Everything else should be handled automatically by Railway.

2 Replies

Anonymous
HOBBYOP

2 years ago

112010fe-dc1e-41d9-9c1b-cb0f97d35093


brody
EMPLOYEE

2 years ago

Railway does not provide a way to provide an nginx.conf file for the staticfile provider.

instead, have railway build your app and then serve it with caddy, example here

take note of the nixpacks.toml and Caddyfile


Loading...