#user root; user nobody; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; client_header_buffer_size 256k; client_max_body_size 8m; open_file_cache max=102400 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses 1; proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; proxy_buffer_size 256k; proxy_buffers 8 128k; proxy_busy_buffers_size 256k; proxy_temp_file_write_size 256k; proxy_cache_path html/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g; proxy_temp_path html; map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream zwlbsvideo { ip_hash; server zwlbsvideo:8080; } #gzip on; ################################################### server { listen 80; server_name zwlbsvideo; location /{ return 302 /clbs/; } location /clbs/ { proxy_pass http://zwlbsvideo; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; } location ~ .*\.(html|js|css|png|gif|jpg)$ { proxy_cache cache_one; proxy_cache_valid 200 304 24h; proxy_cache_valid any 10m; expires 24h; if ( !-e $request_filename) { proxy_pass http://zwlbsvideo; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } ####################################################### server { listen 8799; server_name 0.0.0.0; location / { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; root html; index index.html index.htm; } location ~ (favicon.ico) { } location = /favicon.ico { return 204; access_log off; log_not_found off; } location /mediaserver { if ($request_filename ~* ^.*?.(wav|mp4|png|jpeg|jpg)$){ add_header Content-Disposition attachment; } alias /var/ftp/public_root/; } location /app { if ($request_filename ~* ^.*?.(wav|mp4|png|jpeg|jpg|apk)$){ add_header Content-Disposition attachment; } alias /var/ftp/app; autoindex on; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }