Nixpacks Staticfile provider configure NGINX for SPA
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.
Solution:Jump to solution
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
https://github.com/brody192/vite-react-template
take note of the nixpacks.toml and Caddyfile...
3 Replies
Project ID:
112010fe-dc1e-41d9-9c1b-cb0f97d35093
112010fe-dc1e-41d9-9c1b-cb0f97d35093
Solution
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
https://github.com/brody192/vite-react-template
take note of the nixpacks.toml and Caddyfile