Created
October 9, 2012 15:17
-
-
Save dordenis/3859463 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 { | |
listen 78.46.77.145; | |
#listen 80; ## listen for ipv4; this line is default and implied | |
#listen [::]:80 default ipv6only=on; ## listen for ipv6 | |
root /var/www/kupi.ru/current; | |
index index.php index.html index.htm; | |
# Make site accessible from http://localhost/ | |
server_name kupi.ru *.kupi.ru; | |
if ($host ~ "^(.*).kupidev.ru") { | |
set $category $1; | |
rewrite ^(.*) /shop/$category$1 last; | |
} | |
# ROUTING TO KOHANA IF REQUIRED | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to index.html | |
try_files $uri $uri/ @kohana; | |
} | |
# BLOCKS ACCESS TO . FILES (.svn, .htaccess, ...) | |
location ~ /\. { | |
deny all; | |
} | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
# | |
#error_page 500 502 503 504 /50x.html; | |
#location = /50x.html { | |
# root /usr/share/nginx/www; | |
#} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
location ~ \.php$ { | |
# PHP FILES MIGHT BE TO HANDLED BY KOHANA | |
try_files $uri $uri/ @kohana; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
# HANDLES THE REWRITTEN URLS TO KOHANA CONTROLLER | |
location @kohana { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root/index.php; | |
} | |
# CACHE CONTROL FOR STATIC FILES | |
location ~* \.css|\.js|\.jpg|\.jpeg|\.png|\.gif|\.swf|\.svg|\.tiff|\.pdf$ { | |
expires 30d; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment