Deploy react app on shared hosting

qasimnadeem

Qasim Nadeem

Posted on May 30, 2020

Deploy react app on shared hosting

For deploying a react app on a shared hosting you need to create a production build. Production build is a pack of all your react code and its dependencies.

in most shared hosting we put our site/app inside a public_html directory so if we hit www.yourdomain.com it serves the code from public_html directory.

so if your react app is ready to go, edit your package.json file add a new key value:

"homepage":"http://yourdomain.com"

then create a build using following command:

npm run build

after running the command you will see a new directory named build in your app root. It will contain js and css for the app and a index.html file. You need to upload all the content inside build directory to public_html directory, and that's all, go to your domain and your app will be working just fine.

💖 💪 🙅 🚩
qasimnadeem
Qasim Nadeem

Posted on May 30, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related