nginx wordpress

    location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg
                  |jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid
                  |midi|wav|bmp|rtf)$ {

https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/

https://unix.stackexchange.com/questions/140388/sort-comma-separated-fields-on-each-line-by-numeric-value

$ echo "ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf" | tr "|" "\n" | sort | tr "\n" "|"
atom|bmp|bz2|css|doc|eot|exe|gif|gz|ico|jpeg|jpg|js|mid|midi|mp4|ogg|ogv|otf|png|ppt|rar|rss|rtf|svg|svgz|tar|tgz|ttf|wav|woff|xls|zip|

security

# WordPress: deny general stuff
location ~* ^/(?:xmlrpc\.php|wp-links-opml\.php|wp-config\.php|wp-config-sample\.php|wp-comments-post\.php|readme\.html|license\.txt)$ {
        deny all;
}

https://gist.github.com/nfsarmento/57db5abba08b315b67f174cd178bea88

~* 正規表現(大文字・小文字を区別しない)
nginx連載5回目: nginxの設定、その3 - locationディレクティブ - インフラエンジニアway - Powered by HEARTBEATS 2012

(?:...) マッチングは通常に行われますが、マッチした文字列が \1 や $1 などにキャプチャされません。
とほほの正規表現入門 - とほほのWWW入門

#Disable execution of scripts other than PHP from your document root
location ~* .(pl|cgi|py|sh|lua|asp)$ {
   return 444;
}

nginx でステータスコード「444」を返すコードを見掛けて、なんぞや!って思って調べた
nginx の独自のステータスコードで、何も返さないでコネクションを閉じる
悪意のあるボットからのアクセスを遮断する時などに使ったりするらしい
【nginx】ステータスコード「444」 | 高木のブログ 2022

plugin .htaccess

プラグイン.htaccess でアクセス制御している場合
nginxのconfに同等の設定を追加する。


wp-content/plugins/akismet/.htaccess
wp-content/updraft/.htaccess
wp-content/uploads/wpcf7_uploads/.htaccess