N
N
Nikolai2019-02-13 12:30:16
Nginx
Nikolai, 2019-02-13 12:30:16

How to implement two react applications on the same domain?

There is a server with Nginx. There is one domain. There are two react applications (showcase and admin). What is the best way to host them on the same domain?
I would like people to go to the online store on site.com/, and on site.com/admin the administrator could go to the admin panel. I tried using the location in the nginx settings, but it doesn’t even work, I can’t find the right configuration.
As an option, I thought to make an admin panel on the admin.site.com subdomain, but this is an ugly solution (two folders in the directory with the rest of the sites).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2019-02-13
Demidovets @Nik_o_lay

In the react itself, everything is clear, if your /admin path is not described in the route, then the link to it will work like a regular link and pull the page from the server
. In nginx, the /admin location must be located higher than the location for the entire application.

K
ky0, 2019-02-13
@ky0

It is possible both through a subdomain and through a URL, it is configured with two server blocks and two locations, respectively. There are examples in the nginx manual, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question