L
L
lumb2018-10-13 02:00:20
Nginx
lumb, 2018-10-13 02:00:20

How to set an alias for folders in nginx?

Previously, on the site, all images, pdf, etc. were in the /uploads/posts/ folder (inside which the structure also contains folders with files)
Now the same set is located at /assets/uploads/
What to write in nginx so that the content is available and so and so?

location /uploads/posts/ {
    alias /assets/uploads/;
}

did not give any result

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lumb, 2018-10-13
@lumb

Correct answer (in case of images and files other than php)

location ^~ /uploads/posts {
    alias /var/www/os/www/assets/uploads;
    add_header Cache-control "public";
    access_log   off;
    expires      90d;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question