Created
September 12, 2010 05:18
-
-
Save roktas/575865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# kanonik kök dizin | |
root /srv/www/$host/site; | |
# öntanımlı indeksler | |
index index.html index.htm index.php; | |
# flv dosyalarında flv modülü etkin | |
location ~ \.flv$ { | |
flv; | |
} | |
# logları kirleten bazı botları reddet | |
if ($http_user_agent ~* (Baiduspider|Morfeus\ strikes)) { | |
return 444; | |
} | |
# nokta dosyalar daima gizli olmalı | |
location ~ /\. { | |
deny all; | |
} | |
# logları kirleten script-kiddie istekleri | |
location ~* /(phpmyadmin|php-my-admin)/ { | |
deny all; | |
} | |
# sahte refererları reddet | |
if ($http_referer ~* (babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversoftware|sex|teen|video|webcam|zippo)) { | |
return 444; | |
} | |
# bakım kipi - kök dizinde .503 dosyası varsa sistem bakımda | |
if ( -f $document_root/.503) { | |
return 503; | |
} | |
# robot dosyası yoksa logları kirletme | |
location = /robots.txt { | |
log_not_found off; | |
} | |
# debian paket deposu sunuyorsak loglar kirlenmesin | |
location ~ /debian/.*(/i18n/Translation-|\.diff/Index).*$ { | |
log_not_found off; | |
} | |
# standart www yönlendirmesi | |
if ($host ~* www\.(.*)) { | |
set $x_host_without_www $1; | |
rewrite ^(.*)$ http://$x_host_without_www$1 permanent; | |
} | |
# özel 404 sayfası daima /40x/ dizininde | |
error_page 404 @40x; | |
location @40x { | |
rewrite ^(.*)$ /40x/index.html break; | |
} | |
# sistem bakımda sayfası daima /50x/ dizininde | |
error_page 500 502 503 504 @50x; | |
location @50x { | |
rewrite ^(.*)$ /50x/index.html break; | |
} | |
# statik dosyalarda zaman aşımını uzat | |
#location ~* \.(js|css|jpe?g|gif|png|svg|swf|pdf|docx?|odf|ppt|tar\.gz|zip|rar)$ { | |
# expires 31d; | |
# break; | |
#} | |
# bunun yerine | |
# tüm dosyalar için öntanımlı zaman aşımı değeri | |
location / { | |
expires 30d; | |
} | |
# php hangi dosyalarda etkin? | |
location ~ \.(php|phtml)$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $request_filename; | |
include fastcgi_params; | |
} |
Benim şuanki konfigürasyonumda server_name
tek başına yeterli olmayacaktır. Çünkü burdaki girdiğim pathler harici bir yere erişmesini istemiyorum kodun misal fastcgi_param SCRIPT_FILENAME $request_filename
ile başka bir dizindeki bir dosyaya erişmesi mümkün sanki?
Nginx'in çok güzel özellikleri var. Ama dediğiniz gibi keşfetmek için çok araştırmak ve denemeler yapmak zorunda kalıyoruz. Bilgilerimizi paylaşalım :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Örneğin yukarıda verdiğiniz yapılandırmada sadece server_name kısmında
ALANADI
gerekiyor. Diğer ayarların hiçbirindeALANADI
kullanmanıza gerek yok. Nginx'in pek çok özelliği var. Fakat bu özellikler ayrıntılı şekilde dokümante edilmediğinden bazen bunları keşfetmek zor oluyor.