Deploy yew with nginx

169 views Asked by At

I am trying to deploy a yew app with nginx but when I do, I am unable to visit other pages. I can only go to /, but I also have for example a /profile/1234 route. Locally if I run the app with trunk serve I can access that page. But on my server I get a 500 error.

From what I read on https://yew.rs/docs/next/more/deployment, it seems you only need to compile the project with trunk build --release and serve from the dist/ directory (index.html, a js and a wasm file). Maybe I have to do something more here? Also, clicking a link from within the / page works, but refreshing the page or manually going to a page doesn't.

My /etc/nginx/sites-available/project configuration:

server {
        listen 80;
        server_name <public_ip>;
        location / {
                     root /var/www/frontend/dist;
                     index index.html;
                     try_files $uri $uri/ /front/index.html;
        }
}
0

There are 0 answers