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

232
Views
Why my subdirectory "/game" of the react website cannot be served from nginx?

I have a website with has one subdirectory named "/game". There is no problem when I click the tab in navbar when I execute the website in localhost (localhost:3000/game is working!). But when I want to access using my domain address, it gives me error "404 The requested page was not found." (mydomain/game is not working!)

What am I missing?

React Part - Navbar.js :

...

<a href="/game">
  <span>Game</span>
</a>

...

React Part - Game.js :

import React, { Component } from 'react'

export default class Game extends Component {
    render() {
        return (
            <div className='text-white text-center game'>
                GAME INFORMATION
            </div>
        )
    }
}

React Part - App.js :

function App() {
  return (
    <BrowserRouter>
      <Routes>
        <Route path="/" element={
          <div className="App">
            <header className='Main-header'>
              <Navbar />
              <Hero />
            </header>
            <About />
            <Gallery />
            <Faq />
          </div>
        } />
        <Route path="/game" element={<Game />} />
      </Routes>
    </BrowserRouter>
  );
}

export default App;

Nginx Part, after typing vi default :

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        server_name _;

        location / {
                proxy_pass http://localhost:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Probably just an ssl error. Try to get a certificate from letsencrypt.

about 4 years ago · Juan Pablo Isaza Report
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!