A
A
ar52016-05-26 12:22:50
JavaScript
ar5, 2016-05-26 12:22:50

Is it possible to put ReactJS on nginx?

Hello, I would like to understand one question, I built a ReactJS site through Webpack and tried to put it on nginx, I started having problems with routing and access to my bundle. I so understand it is necessary to request the address. In general, is it possible to upload the application that I built to the statics server, I read a lot of things, but I didn’t understand the essence. Or be sure to raise the nodejs server for all this

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Aves, 2016-05-26
@ar5

You need to set up nginx like this:

location / {
    root /var/www;
    index index.html;

    try_files $uri $uri/ /index.html;
}

And specify in index.html <base href="/">so that relative paths work.

S
spotifi, 2016-05-26
@spotifi

It is possible and necessary.
It is executed on the client. The client just needs to download it. This is a typical nginx task.
Something messed up with the path.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question