Nginx ignores URL case-sensitive configurations
Sometimes the URI is case-insensitive, for example, http: // 127.0.0.1/abc.jpg. Generally, the URI is case sensitive. If you use the/ABc. jgp and/abc.jpgwriting methods, you can disable the resource abc.jpg. Here, we will discuss how to ignore the case sensitivity issue in the URI so that it can be accurately identified by nginx regardless of the upper or lower case:
1: Install the perl development kit.
# Yum-y install perl *
2: recompile nginx, add -- with-http_perl_module to make it support perl.
3: Modify the nginx configuration file and add the case-insensitive syntax to the http {} Option.
# Vingpattern. conf
Perl_set $ url'
Sub {
My $ r = shift;
My $ re = lc ($ r-> uri );
Return $ re ;}';
4: Apply the syntax configuration and add the following configuration to the server {} Option:
If ($ uri ~ [A-Z]) {
Rewrite ^ (. *) $ url last;
You can also configure a separate directory:
Location/xxx {
If ($ uri ~ [A-Z]) {
Rewrite ^ (. *) $ url last;
}
For more Nginx tutorials, see the following:
Deployment of Nginx + MySQL + PHP in CentOS 6.2
Build a WEB server using Nginx
Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5
Performance Tuning for Nginx in CentOS 6.3
Configure Nginx to load the ngx_pagespeed module in CentOS 6.3
Install and configure Nginx + Pcre + php-fpm in CentOS 6.4
Nginx installation and configuration instructions
Nginx log filtering using ngx_log_if does not record specific logs
Nginx details: click here
Nginx: click here
This article permanently updates the link address: