reactjs - How to specify a port number in a create-react-app based project in production? -


i deploying website have few react projects built create-react-app. each project on own webpage: e.g.: mywebsite.com/project1, mywebsite.com/project. setting nginx reverse proxy on ubuntu server (which understand how configure), not sure how specify port numbers each of create-react-app projects each of them has unique port. can shed light on how this? thanks!

ps - have seen threads such 1 - how specify port run create-react-app based project?, not see how solution can applied in production.

the server start npm start command in create-react-app webpack dev server. meant use while development , shouldn't use in production environment.

instead, can host cra app simple static file server can easily configure nginx without reverse proxy or changing port of dev server. need run npm run build command , deploy content of build folder appropriate folder of static file server. can read more in the documentation of cra.

also, make sure specify homepage in package.json before building project, since going host app in relative path mywebsite.com/project1. because cra assumes app hosted @ server root default settings.

hope helps!


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -