Deploy React Project in Tomcat Server

React project is little different than other project for tomcat server. To deploy the react application (production build) just follow the step bellow.

Step 1: Create a project directory as like “appname” in webapps dir of tomcat.

Step 2: In react project add “homepage”: “/appname” in package.json file. If you use router in your project then add “appname” as basename.

<Router basename={“/appname”}>

Step 3: Then run build command.

Step 4: Copy all the build files to “appname” folder of tomcat webapps directory.

Step 5: Restart the server.

Thats it.

Leave a Reply

Your email address will not be published. Required fields are marked *