1
4 Comments

does anyone know how to host a SPA react app on nginx.

I was able to go to the home page but getting a 404 on other routes. I tried suggestions on stack overflow like try_files $uri $uri/ index.html and tried other variation of it but still cant get to work.

  1. 1

    share your nginx config

  2. 1

    I know I am not answering your question, but if you're delivering static JS/CSS/HTML files to people, would it be easier and faster to host it with something like netlify.com or zeit.co?

    Both have generous free plans (I use netlify personally) and it is just ridiculous how easy and fast you can get set up.

  3. 1

    did you double check that your root is set to the build directory of your react app?

    for instance my project is at:
    /var/www/portfolio

    when I build the react app it goes to:
    /var/www/portfolio/build

    1. 2

      another comment, your '/' maybe in the wrong place
      mine looks like:

      try_files $uri /index.html
      
Trending on Indie Hackers
Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 19 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments How I Launched FrontendEase 13 comments