Score:0

Make Linux File System Case Insensitive

at flag

I deployed a website on Linux using NGINX as there server.

My files are in lower-case and are located at /susr/share/nginx/html When I request for the files using upper-case it returns a 404.

Example: https://example.com/about works fine but https://example.com/About return a 404 error.

server {
         listen 80;
        listen [::]:80;
        
        server_name example.com www.example.com;
        root /usr/share/nginx/html;

        location ~* ^/ {
            index  index.html index.htm;
            # Remove .html extension
            if ($request_uri ~ ^/(.*)\.html(\?|$)) {
                return 302 /$1$is_args$args;
            }
            try_files $uri $uri.html $uri/ = 404;
        }
        # remove trailing slash
        if (!-d $request_filename) {
            rewrite ^/(.*)/$ /$1 permanent;
        }
        
        error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;

        location = /50x.html {
            root   /usr/share/nginx/html;
        }
            
        
    }

My research shows that the problem is not the nginx configuration but the Linux file system.

How can I enable case-insensitive on Linux to make the nginx to treat lower and upper case files and directory as the same.

Thank you.

David avatar
cn flag
Yo do not. That is how it is meant to work.
pl flag
Who types URLs? Your site should have links which take users from page to page. Don't make users guess the URL. Making the system case insensitive is the wrong solution to this problem.
Bloggrammer avatar
at flag
Alright. Sounds good!
cc flag
You could put your files on a FAT filesystem and then case would not matter.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.