我有图片,我想添加他们的标题为最大,我有个人资料的图片,可以更改和发布图片,我想添加标题只为后期图片,但不是个人资料图片,我不知道如何管理这个.谢谢,这是我的配置,
this is the path of posts,/post/name-of-the-picture.jpg
this is the path of users,/user/name-of-the-picture.jpg
location ~* \.(css|js|png|gif)${
expires max;
add_header Pragma public;
add_header Cache-Control "public";
}
最佳答案
目前我们有两个选择来解决这个问题:
选项1:
Duplicated locations: Nginx looks for the best match. (a little better performance)
location /post/ {
post config stuff;
.
.
.
}
location ~* ^/post/.*\.(css|js|png|gif)${
post/files.(css|js|png|gif) config stuff;
expires max;
add_header Pragma public;
add_header Cache-Control "public";
}
location /user/ {
user folder config stuff;
.
.
.
}
location ~* ^/user/.*\.(css|js|png|gif)${
user/files.(css|js|png|gif) config stuff;
.
.
.
}
选项二:
Nested locations: Filtered by extension in the inner location blocks
location /post/{
...
location ~* \.(css|js|png|gif)${
expires max;
add_header Pragma public;
add_header Cache-Control "public";
}
}
location /user/{
...
location ~* \.(css|js|png|gif)${
...
}
}