./configure –prefix=/srv/nginx-1.6.0 –with-file-aio –with-http_image_filter_module –with-http_flv_module –with-http_mp4_module –with-http_gzip_static_module –with-http_stub_status_module –add-module=../ngx_devel_kit-0.2.19 –add-module=../lua-nginx-module-0.9.7 && make && make install
#user nobody; worker_processes 4; error_log /var/log/nginx/error.log info; pid logs/nginx.pid; worker_rlimit_nofile 50000; events { use epoll; worker_connections 50000; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; sendfile_max_chunk 256K; tcp_nopush on; log_not_found off; open_file_cache max=1024 inactive=60s; open_file_cache_valid 60s; open_file_cache_min_uses 2; open_file_cache_errors on; keepalive_timeout 0; gzip on; server_tokens off; client_max_body_size 256m; client_body_temp_path /dev/shm/client_body_temp 1 2; fastcgi_temp_path /dev/shm/fastcgi_temp 1 2; proxy_temp_path /dev/shm/proxy_temp 1 2; lua_package_path '/usr/local/share/luajit-2.0.3/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/socket/?.lua;;'; lua_package_cpath '/usr/local/lib/lua/5.1/?.so;;'; init_by_lua 'iconv, cjson, redis = require "iconv", require "cjson", require "redis"'; server { listen 80; server_name static.******.com; root /var/static.******.com; set $script_path '/var/static.******.com/scripts'; location / { return 403; } location = /crossdomain.xml { #Flash request require this file. } location = /up { access_by_lua 'ngx.req.set_uri("/scripts/upload_script.php")'; include fastcgi.conf; } location = /accessToken { access_by_lua 'ngx.req.set_uri("/scripts/accessToken_script.php")'; include fastcgi.conf; } location ~ ^/([^\/]+)/([\w]+)/info$ { default_type "application/json"; set $domain $1; set $fn $2; access_by_lua_file $script_path/info.lua; } location ~ ^/([^\/]+)/([\w]+)$ { set $domain $1; set $fn $2; access_by_lua_file $script_path/stream_and_download.lua; } location ~ ^/([^\/]+)/([\w]+)/([\d]+)/([\d]+)$ { set $domain $1; set $fn $2; set $width $3; set $height $4; access_by_lua_file $script_path/image_filter.lua; image_filter resize $width $height; } location ~ "^/([^\/]+)/([\w]{2})([\w]{2})([\w]{2})([\w]{26})\.flv$" { try_files /$1/$2/$3/$4/$2$3$4$5.flv =404; flv; } location ~ "^/([^\/]+)/([\w]{2})([\w]{2})([\w]{2})([\w]{26})\.mp4$" { try_files /$1/$2/$3/$4/$2$3$4$5.mp4 =404; mp4; mp4_buffer_size 1m; mp4_max_buffer_size 5m; } } }