NGINX and React :net::ERR_ABORTED 404

Viewed 1253

I created a react demo with create-react-app,it runs at http://localhost:3000,and I use NGINX as reverse proxy,nginx.conf is like this:

server {
        listen       3001;
        server_name  localhost;


        location / {
            proxy_pass http://localhost:3000;
        }


        location /api { 
            proxy_pass  http://192.168.33.3:8080;    
        }  

 }

when I access http://localhost:3001,there is an error:

![clipboard.png](/img/bVblSu5)

What should I do?

1 Answers

Try to add root in your server pointing to react bundle:

server {
    root /var/www/html/bundle
}
Related