centos-rhel服务器相关 / 未分类 · 2013年3月27日


Checks the truth of a condition. If the condition evaluates to true, then the code indicated in the curly braces is carried out and the request is processed in accordance with the configuration within the following block. The configuration inside the ifdirective is inherited from the previous level.
The condition can be:
the name of a variable; false values are: empty string (“”, or any string starting with “0”;
a comparison of a variable using the = and != operators;
pattern matching with regular expressions:
~ performs a case-sensitive match
~* performs a case-insensitive match (firefox matches FireFox)
!~ and !~* mean the opposite, “doesn’t match”
checking for the existence of a file using the -f or !-f operators;
checking for the existence of a directory using -d or !-d;
checking for the existence of a file, directory or symbolic link using -e or !-e;
checking whether a file is executable using -x or !-x.