Help us understand the problem. What is going on with this article?

nginxでlocationを使う時の演算子

More than 5 years have passed since last update.

知らなかったのでメモ

# 「=」は完全一致。/index.phpにしか反応しない
location = /index.php {
}

# 無印は前方一致、但し正規表現より弱い
location /index.php {
}

# 「^~」も前方一致、こちらは正規表現より強い
location ^~ /index.php {
}

# 「~」はcase sensitive(大文字と小文字を別に扱う)な正規表現
location ~ ^/index\.php$ {
}

# 「~*」はcase insensitive(大文字と小文字を区別しない)な正規表現
location ~* ^/index\.php$ {
}

~*を知らずに location ~ (jpe?g|JPE?G|gif|GIF|png|PNG)$ とかやっていた。。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away