为什么nginx会在原始http请求中添加一个尾随斜杠?
是什么让nginx在我的请求中添加一个尾随/尾随?目前,这似乎打破了他们为什么nginx会在原始http请求中添加一个尾随斜杠?,nginx,Nginx,是什么让nginx在我的请求中添加一个尾随/尾随?目前,这似乎打破了他们 location ^~ /custom/ { location = /custom/.*\.css$ { alias /var/www/custom } alias /var/www/custom; include uwsgi_params; uwsgi_param REDIRECT_STATUS 200; uwsgi_modifier1 9; uwsgi_pass 127
location ^~ /custom/ {
location = /custom/.*\.css$ {
alias /var/www/custom
}
alias /var/www/custom;
include uwsgi_params;
uwsgi_param REDIRECT_STATUS 200;
uwsgi_modifier1 9;
uwsgi_pass 127.0.0.1:3031;
}
此配置至少有两个问题:
- 如果您请求类似于
/custom/xxx.css的内容,服务器将向uwsgi发送请求
- 发送到uwsgi的请求将是
——此附加斜杠将确保事件uwsgi不会返回该文件/custom/xxx.css/
location = /custom/.*\.css$
出于
location ^~ /custom/
您使用的语法将强制每个请求转到uwsgi 你应该把
location = /custom/.*\.css$
出于
location ^~ /custom/
如果我想要嵌套位置并匹配多个文件扩展名,比如
\(css | png | jpg | gif)
,那么使用什么语法呢?如果我想要嵌套位置并匹配多个文件扩展名,比如\(css | png | jpg | gif)
,那么使用什么语法呢。