Подтвердить что ты не робот

Как сделать регистр URL нечувствительным к Nginx

Я использую Nginx для простого демонстрационного сайта, и я просто настраиваю Nginx следующим образом:

server {
    listen          80;
    server_name     www.abc.com;

    location / {
        index           index.html;
        root            /home/www.abc.com/;
    }
}

В моей папке www.abc.com у меня есть подпапка с именем Sub, а внутри - index.html. Поэтому, когда я пытаюсь посетить www.abc.com/Sub/index.html, тогда он отлично работает. Если я посещаю www.abc.com/Sub/index.html, он возвращает 404.

Как настроить Nginx для нечувствительности к регистру в URL?

4b9b3361

Ответ 1

server {
    # Default, you don't need this!
    #listen          80;

    server_name     www.abc.com;

    # Index and root are global configurations for the whole server.
    index           index.html;
    root            /home/www.abc.com/;

    location / {
        location ~* ^/sub/ {
            # The tilde and asterisks ensure that this location will
            # be matched case insensitive. nginx does not support
            # setting absolutely everything to be case insensitive.
            # The reason is easy, it costly in terms of performance.
        }
    }
}