gpt4 book ai didi

Nginx 配置对图片文件不区分大小写

转载 作者:行者123 更新时间:2023-12-05 07:59:11 24 4
gpt4 key购买 nike

图片只有在大小写正确的情况下才会显示。这些需要不区分大小写,请参阅我的配置文件。

我在以下位置遇到问题的图片:

http://domain.com/sites/default/files/vimages/imagename.jpg

但不在

http://domain.com/sites/default/files/vimages/imagename.JPG

server {

   listen 80;

server_name domain.com;
root /home/domain.com/www; ## <-- Your only path reference.

access_log /home/domain.com/logs/access.log;
error_log /home/domain.com/logs/error.log;

# Enable compression, this will help if you have for instance advagg‎ module
# by serving Gzip versions of the files.
gzip_static on;

gzip on;

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

# This matters if you use drush
location = /backup {
deny all;
}

# Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
allow 192.168.0.0/16;
deny all;
}
location ~ \..*/.*\.php$ {
return 403;
}

# No no for private
location ~ ^/sites/.*/private/ {
return 403;
}

# Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
}

location / {
# This is cool because no php is touched for static content
try_files $uri @rewrite;
}

location @rewrite {
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
rewrite ^ /index.php;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_read_timeout 180;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 52w;
add_header Cache-Control "max-age=31449600, no-transform, public";
log_not_found off;
}

# Catch image styles for D7 too.
location ~* ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}
location ~* /sites/.*/files/vimages/ {
try_files $uri @rewrite;
}
# Fighting with ImageCache? This little gem is amazing.
location ~ ^/sites/.*/files/imagecache/ {
try_files $uri @rewrite;
}

}

最佳答案

Nginx 针对文件系统工作,并且在从目录提供服务时无法控制文件的名称。

如果你想要不区分大小写,你需要重写。

关于Nginx 配置对图片文件不区分大小写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22326187/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com