Created
March 17, 2010 12:56
-
-
Save 1999/335192 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
server { | |
if ( $host ~ ^allcafe\.(info|ru)$ ) { | |
rewrite ^/(.*)$ http://www.allcafe.info/$1 permanent; | |
} | |
if ( $host ~* ^www\.([a-z]+)\.allcafe\.(info|ru)$ ) { | |
set $domain $1; | |
rewrite ^/(.*)$ http://$domain.allcafe.info/$1 permanent; | |
} | |
if ( $host ~* ^([\w]+)\.allcafe\.ru$ ) { | |
set $domain $1; | |
rewrite ^/(.*)$ http://$domain.allcafe.info/$1 permanent; | |
} | |
listen 80; | |
server_name ~^(astrakhan|forum|karelia|kazan|kostroma|krasnodar|krasnoyarsk|msk|nnov|novosibirsk|omsk|pda|perm|pskov|rnd|samara|sochi|tomsk|ufa|vlad|vnov|www)\.allcafe\.info$; | |
set $rootdir $host; | |
if ( $host = www.allcafe.info ) { | |
set $rootdir allcafe.info; | |
} | |
access_log /var/log/nginx/$rootdir-access.log; | |
charset windows-1251; | |
root /home/webserver/allcafe.info/$rootdir/www; | |
location ~* \.(jpe?g|gif|png|ico|doc|swf|css|js|txt)$ { | |
expires 30d; | |
if ( $request_filename ~* protection2?\.jpg$ ) { | |
rewrite ^/(.*)$ /$1 break; | |
error_page 404 = /; | |
} | |
if ( $request_filename ~* (fck)+.+\.js$ ) { | |
charset utf-8; | |
} | |
} | |
location / { | |
proxy_pass http://127.0.0.1:81; | |
proxy_read_timeout 120; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment