1
0
Fork 0

Nginx config

This commit is contained in:
magnolia-fan 2011-04-11 11:26:53 +04:00
parent ffea37188c
commit 71ad3d17e6
2 changed files with 91 additions and 0 deletions

47
nginx/nginx.conf Normal file
View File

@ -0,0 +1,47 @@
worker_processes 1;
error_log logs/error.log debug;
events {
worker_connections 256;
}
http {
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
upstream mongrel {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name bh.vim.me localhost susanna brooklyn;
#root /Users/chez/Sites;
#index index.html index.htm;
try_files $uri @mongrel;
location @mongrel {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://mongrel;
}
include proxy.conf;
#error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

44
nginx/proxy.conf Normal file
View File

@ -0,0 +1,44 @@
# Proxy download
location ~* ^/proxy-stream/(.*?)/(.*?)/(.*?)/(.*?)/(.*) {
# Do not allow people to mess with this location directly
# Only internal redirects are allowed
internal;
# Location-specific logging
#access_log logs/proxy_stream.access.log debug;
#error_log logs/proxy_stream.error.log debug;
# Extract download url from the request
set $token $1;
set $remixsid $2;
set $remixchk $3;
set $download_host $4;
set $download_uri $5;
# Compose download url
set $download_url http://$download_host/$download_uri;
# Compose cookie string
set $cookie "remixsid=$remixsid;remixchk=$remixchk";
# Set download request headers
proxy_set_header Host $download_host;
proxy_set_header Cookie $cookie;
proxy_set_header Referer "http://vkontakte.ru/audio?album_id=0";
# The next two lines could be used if your storage
# backend does not support Content-Disposition
# headers used to specify file name browsers use
# when save content to the disk
proxy_hide_header Content-Type;
proxy_hide_header Content-Disposition;
add_header Content-Type 'audio/mpeg';
add_header Content-Disposition 'inline';
# Do not touch local disks when proxying
# content to clients
proxy_max_temp_file_size 0;
# Download the file and send it to client
proxy_pass $download_url;
}