Created
August 28, 2013 06:28
-
-
Save vgrish/6362723 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
upstream backend-test {server unix:/var/run/php5-test.sock;} | |
server { | |
listen 80; | |
server_name ip; | |
root /var/www/test/www; | |
access_log /var/log/nginx/test-access.log; | |
error_log /var/log/nginx/test-error.log; | |
index index.php index.html; | |
rewrite_log on; | |
if ($host != 'ip' ) { | |
rewrite ^/(.*)$ http://ip/$1 permanent; | |
} | |
location ~* ^/core/ { | |
deny all; | |
} | |
location / { | |
try_files $uri $uri/ @rewrite; | |
} | |
location @rewrite { | |
rewrite ^/(.*)$ /index.php?q=$1; | |
} | |
location ~ \.php$ | |
{ | |
default_type text/html; | |
set $memcached_key "default/site1$args"; | |
# выполняем запрос к мемкешу | |
#memcached_pass localhost:11211; | |
# выполняем запрос к мемкешу через сокет | |
memcached_pass unix:///var/run/memcached/mem.socket; | |
# устанавливаем обработчик ошибок | |
# если будет получена одна из этих ошибок, то ошибка не будет | |
# возвращена сразу, а будет отправлен запрос дальше на php | |
error_page 404 401 405 502 504 = @php; | |
} | |
location @php { | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_pass backend-test; | |
} | |
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|bmp)$ { | |
access_log off; | |
expires 10d; | |
break; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment