Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
How to serve static react app with nginx from location /app

I am trying to build and serve react app with webpack and nginx.

location /app {
  alias /var/www/react-app;
}

And I am using React router

<Switch>
  <Route exact path = '/'>
    <MainComponent/>
  </Route>

  <Route exact path = '/another'>
    <AnotherComponent/>
  </Route>

...

Dev server works as expected, but deploying to nginx I only get blank page. Adding /app to all routes: exact path = '/app/xxx' and runnning production build fixes the problem for production build.

How can I automate this using webpack/nginx?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!