B
B
barkalov2014-06-17 18:59:13
Nginx
barkalov, 2014-06-17 18:59:13

How to make nginx give a file from one place, and if it is not there, then from another?

Greetings!
Help me please.
There are subdomains:
msk.sitename.com
spb.sitename.com
And the structure on the server:
/documentRoot/msk/
/documentRoot/spb/
/documentRoot/shared/
How to make it so that when requested, for example,
msk.sitename.com/sample. html
was given /documentRoot/msk/sample.html, and if it is not there, then /documentRoot/shared/sample.html would be given?
At the same time, the URL in the browser does not change.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2014-06-17
@barkalov

Search in this direction

location / {
   root /documentRoot;
   try_files msk/ shared/;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question