Nginx (pronounced "engine X") is an open source, high-performance reverse proxy server that supports many load balancing algorithms. The first version was released in 2004, which was created by Igor Sysoev of Russia. Since then, the technology has been adopted by many websites and companies, including Facebook, Google, LinkedIn, Dropbox and others.
When using Nginx to forward requests for a PHP website, this may cause some problems because variable names in PHP are case-sensitive. Especially in Nginx configuration, if the URL contains uppercase letters when accessing it, a "404 Not Found" error may occur. The Linux core is case sensitive by default, while Nginx is case sensitive based on conditions.
To solve this problem, we need to disable Nginx from handling PHP variable names case-sensitively.
Edit Nginx configuration file
Edit your Nginx configuration file. This file may be /etc/nginx/nginx.conf or /etc /nginx/sites-available/YOUR_SITE_NAME etc. It's a good idea to back up the file before making any modifications.
Add the following code
Add the following code in the http block of nginx.conf:
http { . . . #忽略PHP变量名称的大小写 fastcgi_param PHP_VALUE "cgi.fix_pathinfo=off"; . . . }
3. Restart Nginx
After modifying the configuration file, Nginx needs to be restarted for the changes to take effect. You can use the following command:
systemctl restart nginx
Test
Now you can access the page corresponding to the URL address containing uppercase letters, since you have disabled With Nginx now making PHP variable names case-sensitive, you can now access these pages normally.
The above is the detailed content of How to configure Nginx to disable case sensitivity of PHP variable names. For more information, please follow other related articles on the PHP Chinese website!