How to deploy a create-react-SSR-app to a droplet?

November 11, 2019 245 views
Nginx Initial Server Setup React

Hi all,

Quite a beginner here so I hope my questions aren’t too stupid.
I’m looking to improve my web developer skills so I’ve been going from simple html/css to javascript to react etc… and now I’m looking into server side rendering.

First time using digital ocean, I’ve setup a droplet and followed the steps described in this tutorial: https://coderrocketfuel.com/article/deploy-a-create-react-app-website-to-digitalocean

Great stuff, was excited when I was seeing that spinning react logo. Then I thought I would go a step further and set up a ssr version of it. For my ease of use, I’ve been using the handy create-react-ssr-app to do so. When creating the production build, it gives me a build folder containing two files:

  • server.js
  • public (folder) (contains all the basics of a react app with static, app.html etc)

And of course, just copying those files into the nginx html folder does not do the trick, I’m guessing I need to edit the nginx/sites-available/default file so the server goes to the right place? Hope the question is clear enough, essentially, I followed the deploy tutorial, and now would like to do exactly the same but with an ssr react app.

All help is welcome :)
Cheers.

Be the first one to answer this question.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!