Гуглить лучше связку nginx + php-fpm, а конфиги nginx разнообразием не отличаются в общем-то.
Общий конфиг nginx:
Код:
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
use epoll;
multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
merge_slashes on;
client_max_body_size 100m;
server_names_hash_bucket_size 64;
server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_min_length 1000;
gzip_comp_level 3;
gzip_proxied any;
gzip_types text/plain application/xml application/x-javascript text/css application/atom+xml application/json application/rss+xml application/javascript text/javascript text/xml application/xhtml+xml;
gzip_static on;
gzip_vary on;
##
# Php-FastCGI
##
upstream php-fpm {
server unix:/var/run/php5-fpm.sock;
}
##
# Default Index
##
index index.php index.htm index.html;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
Конфиг сайта на TYPO3 с учетом постоянного префикса www, RealURL и настройкой 404-й ошибки по адресу
http://www.domain.tld/404/:
Код:
server {
server_name domain.tld www.jawaclub.su jawaclub.su;
rewrite ^ $scheme://www.domain.tld$request_uri permanent;
}
server {
server_name www.domain.tld;
root /var/www/domain.tld/;
merge_slashes on;
gzip on;
gzip_min_length 1000;
gzip_comp_level 3;
gzip_proxied any;
gzip_types text/plain application/xml application/x-javascript text/css application/atom+xml application/json application/rss+xml application/javascript text/javascript text/xml application/xhtml+xml;
gzip_static on;
gzip_vary on;
gzip_disable "msie6";
location /forum/ {
error_page 404 = /404/;
}
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri /index.php;
fastcgi_pass php-fpm;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param QUERY_STRING $args;
include /etc/nginx/fastcgi_params;
}
### static files
location ~* ^.+\.(jpg|jpeg|gif|png|ico|mp3|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|dat|avi|ppt|txt|tar|mid|midi|wav|bmp|rtf|wmv|mpeg|mpg|tbz|js)$ {
expires max;
valid_referers none blocked server_names
~\.google\. images\.yandex\. ~\.yandex\. ;
if ($invalid_referer) {return 403;}
log_not_found off;
error_page 404 = /404/;
}
location = /clear.gif {
empty_gif;
}
location = /favicon.ico {
root /var/www/domain.tld/www/fileadmin/tmpl;
expires max;
}
location ~* \.css\.gzip$ {
gzip off;
add_header Content-Encoding gzip;
default_type text/css;
expires max;
}
location ~* \.js\.gzip$ {
gzip off;
add_header Content-Encoding gzip;
default_type application/x-javascript;
expires max;
}
location ~ /\.ht {
deny all;
}
}