try_files is a new function added after nginx0.6.36 to search for N files in the specified directory. If fileN is not found, the location specified in fallback is called to process the request. Personally think that as the core content of nginx, it can partially replace the cumbersome rewrite function, I used it in the rewrite rewrite of wp super cache, and also achieved good results.
try_files
Syntax: try_files file1 [file2 ... filen] fallback
Default: None
Scope: Location
The function of this command is to receive multiple paths as parameters. If the resource of the current path cannot be found, the next path will be automatically found. If the requested static resource does not exist, the specified location of the fallback will be requested. Dynamic processing on the background server.
Simple example: location /{try_files index.html index.htm @fallback;}
location @fallback {root /var/www/error;index index.html;} author's The blog has just been established, wp super cache is an indispensable plugin, but the default supercache is for .apaccess of apache, the configuration under nginx is as follows:
set $cache /wp-content/cache /supercache/$host;#wp-super-cache path listen 80; server_name _;location /{root /home/html/s0001/domains/$host;index index.php index.html;#Direct call gzip compression Html static file add_header Content-Type "text/html; charset=UTF-8";add_header Content-Encoding "gzip";try_files $cache/$uri/index.html.gz @proxy;}#All static files Both are processed by nginx and compressed with gzip output location ~* \\.(jpg
Nginx has been widely used in production environments compared to Apaches high performance and high
In the era of Internet, the high availability of the network has always been a very critical part, n
STM32F103VCT6 comes with two 12-bit DAC, DAC conversion speed has not been found, some people say th
Engaged in two years WindowsClient development, what multi-threading, multi-process development, ha
Script for detecting Apache running status under Linux
Linux hard links and soft links deep understanding
Keeping your system secure Avoiding common Linux management errors
Tip: Generate crypt encrypted passwords under Linux
Introduction to the tens of millions of concurrent HAproxy balanced load systems
Linux system information directory
The principle and function of Redo log
The shell script automatically modifies the IP information
Compile vim to solve Chinese support
Overview of Linux I2C Driver Architecture
KVM Fundamentals and Architecture - Concepts and Terminology
Tips to share: Win8 version of QQ card dead serious official solution
After Win7 upgrades Win8 system, the touchpad fails to use the driver life
Linux grub2 startup failure solution
Clever thinking, let the desktop accommodate more icons
Resolve Win7/Win8.1 wireless network connection limited faults
Put the recycle bin directly "please" to the taskbar. Also refresh your desktop
How does Win10 change the disk size? How to change the disk size of Win10
Windows delete files or folders are rejected, you need administrators to provide permissions only
What should I do if the Win8 desktop icon turns white? Win8 desktop icon whitening 2 solutions