Reputation: 2612
I created react app using create-react-app. I have deployed to aws.
How can I run it in production without using server like apache or nginx ?
Thank You.
Upvotes: 1
Views: 5335
Reputation: 2955
You should install nginx on your EC2 instance.
Then, run npm run build
. It will generate a build
folder, that then should be used as nginx vhost webroot
.
npm run build
Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes. Your app is ready to be deployed!
Simple as that.
Or,
For environments using Node, the easiest way to handle this would be to install serve and let it handle the rest:
npm install -g serve serve -s build
Upvotes: 2