
Nginx » Özellikle yüksek trafikli web siteleri için tavsiye edilen, apache'ye rakip gösterilen hızlı, stabil ve popüler web sunucusu.
Apache ve Lighttpd ile karşılaştırıldığında çok daha az CPU kullanır.
NGINX Güvenlik Yapılandırması Nasıl Yapılır?
NGINX Yapılandırma dosyamız aşağıdaki gibidir, bunu security.conf
adı altında /etc/nginx/conf.d/
içerisine atıp istediğiniz bir vhostunuzda kullanabilirsiniz.
location /.git { deny all; }
location /.htaccess { deny all; }
location /.htpasswd { deny all; }
location /.user.ini { deny all; }
location ~ ^/\. { deny all; }
location ~ ~$ { deny all; }
location ~* /uploads/.*\.php$ { deny all; }
location ~* /files/.*\.php$ { deny all; }
location ~* "/(^$|readme|license|example|README|LEGALNOTICE|INSTALLATION|CHANGELOG)\.(txt|html|md)" {
deny all;
}
location ~* "\.(old|orig|original|php#|php~|php_bak|save|swo|aspx?|tpl|sh|bash|bak?|cfg|cgi|dll|exe|git|hg|ini|jsp|log|mdb|out|sql|svn|swp|tar|rdf|gz|zip|bz2|7z|pem|asc|conf|dump)$" {
deny all;
}
location ~* "/(=|\$&|_mm|(wp-)?config\.|cgi-|etc/passwd|muieblack)" {
deny all;
}
location ~* "(base64_encode)(.*)(\()" {
deny all;
}
location ~* "(eval\()" {
deny all;
}
location ~* "(127\.0\.0\.1)" {
deny all;
}
location ~* "([a-z0-9]{2000})" {
deny all;
}
location ~* "(javascript\:)(.*)(\;)" {
deny all;
}
location ~* "(GLOBALS|REQUEST)(=|\[|%)" {
deny all;
}
location ~* "(<|%3C).*script.*(>|%3)" {
deny all;
}
location ~ "(\\|\.\.\.|\.\./|~|`|<|>|\|)" {
deny all;
}
location ~* "(boot\.ini|etc/passwd|self/environ)" {
deny all;
}
location ~* "(thumbs?(_editor|open)?|tim(thumb)?)\.php" {
deny all;
}
location ~* "(\'|\")(.*)(drop|insert|md5|select|union)" {
deny all;
}
location ~* "(https?|ftp|php):/" {
deny all;
}
location ~* "(=\\\'|=\\%27|/\\\'/?)\." {
deny all;
}
location ~ "(\{0\}|\(/\(|\.\.\.|\+\+\+|\\\"\\\")" {
deny all;
}
location ~ "(~|`|<|>|:|;|%|\\|\s|\{|\}|\[|\]|\|)" {
deny all;
}
.git
, .DS_Store
vb gibi başında nokta olup gizli kalması gereken dosyaları ve yürütülebilir dosyaların erişime engellenmesi, sürüm bilgisi veya sunucu üzerinde koşan uygulamanın bilgilerinin bulunduğu dosyaların erişimlerinin engellenmesi, uzantıya göre erişimin kapatılması, yedeklere erişimin kapatılması gibi işlemlerde kullanılabilir.