N
N
Ninja Mate2017-07-16 19:48:23
JavaScript
Ninja Mate, 2017-07-16 19:48:23

How to run react-scripts bundle on nginx server?

It’s not the first day I’ve been trying to launch my front end on the server
, the project structure is the following - project / api (launch node / express 8081) / web (react-scripts) / build
from api, launch backend

nodeserver.js
we get a message that everything is running on 8081
in the web folder, I'm running
serve -s build
we get a message that everything is running on 5000
how to configure ngnix now?
server {
        listen 80 default_server;
        listen [::]:5000 default_server;

        root /home/ubuntu/project/web/build;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                try_files $uri $uri/ =404;
        }

I can’t run it on 5000 now it’s busy
if I send it to another (5001), then it starts via serve on 5000, but I see index in the browser but nothing works, apparently I’m setting root or something else incorrectly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Ernest Fayzullin, 2017-07-16
@ernesto77

try removing/commenting out the lines
# listen 80 default_server;
# server_name_;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question