L
L
linki2014-01-28 00:07:50
Nginx
linki, 2014-01-28 00:07:50

How to configure nginx static return rules?

There is a task that from one virtual folder files from different places undertook. For example, /img/icons/ should be taken from the /home/user/public/icon folder and /img/ui/ from the /home/user/public/ui folder, while /img/logo/ from the /home/user/ folder storage/. How can I write a general rule for the icons and ui folders, since there may be more folders there.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Sundukov, 2014-01-28
@alekciy

IMHO, the most reasonable thing is to spread it to different locations, indicating each root. Those. something along the lines of:

location /img/icons {
  root /home/user/public/icon;
  ...
}

location /img/ui {
  root /home/user/public/ui;
  ...
}
...

E
Eugene, 2014-01-28
@Nc_Soft

see documentation for alias directive

V
Vlad Zhivotnev, 2014-01-28
@inkvizitor68sl

You need to look at alias and root.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question