# how to deploy react app in subdirectory in nginx server After some search i managed the right way to follow in order to configure react applications on nginx server, without going to 404 when refresh page. first of all update the package.json file and add homepage like below: `"homepage": "/admin",` add the basename in index.js: ```XML <Provider basename="/admin"> <App /> </Provider> ``` then update the react router, `process.env.PUBLIC_URL`: contain the public url/base-name: <Router> <Route path={`${process.env.PUBLIC_URL}/login`} /></Route> <Route path={`${process.env.PUBLIC_URL}/dashboard`} /> </Router> then update the nginx config file add: ```JSON location /admin { alias /var/www/paw-admin-portal/build; try_files $uri $uri/ /admin/index.html; } ``` the route call should be processed as below: <Redirect to={${process.env.PUBLIC_URL}/dashboard`} />`