Score:0

Nginx not can't recognize files using if statement

pa flag

I'm trying to perform an operation based on the existence of a file in the file system using Nginx 1.24.0 and Amazon Linux 2.

However, this code is always returning 404.

location ~ ^/test {
    if (-e "/tmp/hello.txt") {
        return 200 "file exists";
    }
    return 404 "not found";
}
  • SELinux is disabled.
  • /tmp/hello.txt exists with nginx:nginx + 777
  • /tmp has 777
  • IF statements are evil, we know it, but for some historical reason we must use if.

What could the problem be?

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.