location / {
try_files /system/maintenance.html
$uri $uri/index.html $uri.html
@mongrel;
}
location @mongrel {
proxy_pass http://mongrel;
}
http {
...
geo $country {
default other;
127.0.0.0/24 msk;
10.1.0.0/16 spb;
192.168.1.0/24 other;
}
map $country $filename {
default other.html.gz;
msk msk.html.gz;
spb spb.html.gz;
other other.html.gz;
}
...
}
server {
...
location /contacts {
rewrite .* $filename break;
alias /var/www/server.com/cache/contacts/;
gzip on;
try_files $uri @fallback;
}
location @fallback {
fastcgi_pass 127.0.0.1:9000;
}
...
}
server {
listen 80;
server_name domain.com;
location / {
proxy_pass http://domain.com:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
location ~* \.(jpg|jpeg|gif|png|svg|js|css|swf)$ {
root /var/www/html/domain.com;
}
}
server {
listen 80;
server_name domain.ru;
root /var/www/domain.ru;
access_log /data/logs/nginx/domain.ru.access.log main;
error_log /data/logs/nginx/domain.ru.error.log;
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov|xml|flv|f4v)$ {
add_header Cache-Control public;
expires 24h;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
pm = static
pm.max_children = 60