Q
Q
Qubert2014-03-23 18:04:00
Nginx
Qubert, 2014-03-23 18:04:00

How to set up nginx?

Hello!
I need to make sure that all files with a URL starting with /uploads/ are served from ask-me/uplods
And all files with an extension (.js .css .jpeg, etc.) are served from the ask-me/static
directory this can be done?
What should be written in nginx.conf ?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dan Ivanov, 2014-03-23
@Qubert

Try like this

location ~* ^/uploads/(.+)$ {
        alias /data/www/ask-me/uplods/$1;
}

 location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|pdf|txt|tar|bmp|js|mov|xml|flv|f4v)$ {
        root /data/www/ask-me/static;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question