我正在尝试使用以下语法为网站中的某些图片的位置添加别名:
location ~/^apple-touch-icon(.*)\.png$ {
alias /opt/web_alpha/img/$1;
}
Run Code Online (Sandbox Code Playgroud)
是的,或者我在nginx的access.log中输入了其他东西我收到了这条消息:
"GET /apple-touch-icon.png HTTP/1.1"404 142
但在浏览器中它显示了索引页面
而且我对nginx中的别名和重写感到困惑,我应该使用它
小智 5
服务器位置:
location ~ ^/(apple-touch-icon|browserconfig|favicon|mstile)(.*)\.(png|xml|ico)$ {
root /home/user/project/static/images/favs;
}
Run Code Online (Sandbox Code Playgroud)
关于favs目录:
$ ls -1 static/images/favs /
apple-touch-icon-114x114.png
apple-touch-icon-120x120.png
apple-touch-icon-144x144.png
apple-touch-icon-152x152.png
apple-touch-icon-57x57.png
apple-touch-icon-60x60.png
apple-touch-icon-72x72.png
apple-touch-icon-76x76.png
apple-touch-icon-precomposed.png
apple-touch-icon.png
browserconfig.xml
favicon-160x160.png
favicon-16x16.png
favicon-196x196.png
favicon-32x32.png
favicon-96x96.png
favicon.ico
mstile-144x144.png
mstile-150x150.png
mstile-310x150.png
mstile-310x310.png
mstile-70x70.png
Run Code Online (Sandbox Code Playgroud)