if
if ( $http_user_agent ~ ’curl’) {
set $flag = 0;
}
if ( $http_user_agent ~ ’Android’) {
set $flag = 1;
}
if ( $http_user_agent ~ ’Windows’) {
set $flag = 2;
}
if ( $http_user_agent ~ ’Macintosh’) {
set $flag = 2;
}
if
演算子 意味
なし
変数名, 変数の値が空の文字列また
は 0 の場合は false
=, != 変数と文字列の比較
~, !~ 大文字と小文字を区別する比較
~*, !~* 大文字と小文字を区別しない比較
-f, !-f ファイルの存在をチェック
-e, !-e
ファイル、ディレクトリ、シンボリ
ックリンクの存在を確認
-x, !-x 実行可能ファイルのチェック
if ( $http_user_agent ~ ’curl’) {
set $flag = 0;
}
if ( $http_user_agent ~ ’Android’) {
set $flag = 1;
}
if ( $http_user_agent ~ ’Windows’) {
set $flag = 2;
}
if ( $http_user_agent ~ ’Macintosh’) {
set $flag = 2;
}
if
簡単に書けるのでコンフィグが長くなる原因の一つ
演算子 意味
なし
変数名, 変数の値が空の文字列また
は 0 の場合は false
=, != 変数と文字列の比較
~, !~ 大文字と小文字を区別する比較
~*, !~* 大文字と小文字を区別しない比較
-f, !-f ファイルの存在をチェック
-e, !-e
ファイル、ディレクトリ、シンボリ
ックリンクの存在を確認
-x, !-x 実行可能ファイルのチェック
if ( $http_user_agent ~ ’curl’) {
set $flag = 0;
}
if ( $http_user_agent ~ ’Android’) {
set $flag = 1;
}
if ( $http_user_agent ~ ’Windows’) {
set $flag = 2;
}
if ( $http_user_agent ~ ’Macintosh’) {
set $flag = 2;
}