| 1 | # configuration file /etc/nginx/nginx.conf:
|
|---|
| 2 | #######################################################################
|
|---|
| 3 | #
|
|---|
| 4 | # This is the main Nginx configuration file.
|
|---|
| 5 | #
|
|---|
| 6 | # More information about the configuration options is available on
|
|---|
| 7 | # * the English wiki - http://wiki.nginx.org/Main
|
|---|
| 8 | # * the Russian documentation - http://sysoev.ru/nginx/
|
|---|
| 9 | #
|
|---|
| 10 | #######################################################################
|
|---|
| 11 |
|
|---|
| 12 | #----------------------------------------------------------------------
|
|---|
| 13 | # Main Module - directives that cover basic functionality
|
|---|
| 14 | #
|
|---|
| 15 | # http://wiki.nginx.org/NginxHttpMainModule
|
|---|
| 16 | #
|
|---|
| 17 | #----------------------------------------------------------------------
|
|---|
| 18 |
|
|---|
| 19 | user nginx;
|
|---|
| 20 | worker_processes auto;
|
|---|
| 21 | worker_rlimit_nofile 245760;
|
|---|
| 22 |
|
|---|
| 23 | error_log /var/log/nginx/error.log;
|
|---|
| 24 | #error_log /var/log/nginx/error.log notice;
|
|---|
| 25 | #error_log /var/log/nginx/error.log info;
|
|---|
| 26 |
|
|---|
| 27 | pid /var/run/nginx.pid;
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 | load_module modules/ngx_http_vod_module.so;
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | #----------------------------------------------------------------------
|
|---|
| 34 | # Events Module
|
|---|
| 35 | #
|
|---|
| 36 | # http://wiki.nginx.org/NginxHttpEventsModule
|
|---|
| 37 | #
|
|---|
| 38 | #----------------------------------------------------------------------
|
|---|
| 39 |
|
|---|
| 40 | events {
|
|---|
| 41 | worker_connections 131070;
|
|---|
| 42 | multi_accept on;
|
|---|
| 43 | use epoll;
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 | #----------------------------------------------------------------------
|
|---|
| 48 | # HTTP Core Module
|
|---|
| 49 | #
|
|---|
| 50 | # http://wiki.nginx.org/NginxHttpCoreModule
|
|---|
| 51 | #
|
|---|
| 52 | #----------------------------------------------------------------------
|
|---|
| 53 |
|
|---|
| 54 | http {
|
|---|
| 55 | include /etc/nginx/mime.types;
|
|---|
| 56 | default_type application/octet-stream;
|
|---|
| 57 |
|
|---|
| 58 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|---|
| 59 | '$status $body_bytes_sent "$http_referer" '
|
|---|
| 60 | '"$http_user_agent" "$http_x_forwarded_for"';
|
|---|
| 61 |
|
|---|
| 62 | log_format account '$body_bytes_sent $request_time';
|
|---|
| 63 | log_format debugunmasked 'Unmasked $body_bytes_sent $request_time $msec $remote_addr $arg_st $uri $arg_e - $secure_link $status "$http_referer" "$http_user_agent"';
|
|---|
| 64 | log_format debugmasked 'Masked $body_bytes_sent $request_time $msec $remote_addr $status $request_filename';
|
|---|
| 65 | access_log off;
|
|---|
| 66 |
|
|---|
| 67 | sendfile on;
|
|---|
| 68 | tcp_nodelay on;
|
|---|
| 69 | reset_timedout_connection on;
|
|---|
| 70 | client_body_timeout 10;
|
|---|
| 71 | send_timeout 5;
|
|---|
| 72 |
|
|---|
| 73 | keepalive_disable none;
|
|---|
| 74 | keepalive_timeout 65;
|
|---|
| 75 |
|
|---|
| 76 | #gzip on;
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 | upstream main {
|
|---|
| 80 | server unix:/var/run/php-fpm.sock;
|
|---|
| 81 | keepalive 32;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | #
|
|---|
| 85 | # The default server
|
|---|
| 86 | #
|
|---|
| 87 | server {
|
|---|
| 88 | listen 81;
|
|---|
| 89 | listen 80;
|
|---|
| 90 | listen 443 ssl http2;
|
|---|
| 91 |
|
|---|
| 92 | ssl_certificate /etc/nginx/cert.pem;
|
|---|
| 93 | ssl_certificate_key /etc/nginx/cert.key;
|
|---|
| 94 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
|---|
| 95 | ssl_ciphers HIGH:!aNULL:!MD5;
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 | server_name _;
|
|---|
| 99 |
|
|---|
| 100 | #charset koi8-r;
|
|---|
| 101 |
|
|---|
| 102 | #access_log logs/host.access.log main;
|
|---|
| 103 |
|
|---|
| 104 | root /somewhere;
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 | open_file_cache max=200000 inactive=200s;
|
|---|
| 108 | open_file_cache_valid 300s;
|
|---|
| 109 | open_file_cache_min_uses 2;
|
|---|
| 110 |
|
|---|
| 111 | aio on;
|
|---|
| 112 | vod_metadata_cache metadata_cache 4096m;
|
|---|
| 113 | vod_response_cache response_cache 256m;
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 | location /foo/ {
|
|---|
| 119 | access_log /var/log/nginx/stats.log.norotate debugmasked;
|
|---|
| 120 | alias /somewhere/;
|
|---|
| 121 |
|
|---|
| 122 | fastcgi_pass main;
|
|---|
| 123 | fastcgi_keep_conn on;
|
|---|
| 124 | fastcgi_param SCRIPT_FILENAME /somewhere/something;
|
|---|
| 125 | fastcgi_param QUERY_STRING $query_string;
|
|---|
| 126 | fastcgi_param REQUEST_METHOD $request_method;
|
|---|
| 127 | fastcgi_param CONTENT_TYPE $content_type;
|
|---|
| 128 | fastcgi_param CONTENT_LENGTH $content_length;
|
|---|
| 129 | fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|---|
| 130 | fastcgi_param REQUEST_URI $request_uri;
|
|---|
| 131 | fastcgi_param DOCUMENT_URI $document_uri;
|
|---|
| 132 | fastcgi_param DOCUMENT_ROOT /somewhere;
|
|---|
| 133 | fastcgi_param SERVER_PROTOCOL $server_protocol;
|
|---|
| 134 | fastcgi_param HTTPS $https if_not_empty;
|
|---|
| 135 | fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
|---|
| 136 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
|---|
| 137 | fastcgi_param REMOTE_ADDR $remote_addr;
|
|---|
| 138 | fastcgi_param REMOTE_PORT $remote_port;
|
|---|
| 139 | fastcgi_param SERVER_ADDR $server_addr;
|
|---|
| 140 | fastcgi_param SERVER_PORT $server_port;
|
|---|
| 141 | fastcgi_param SERVER_NAME $server_name;
|
|---|
| 142 | fastcgi_param REDIRECT_STATUS 200;
|
|---|
| 143 | gzip on;
|
|---|
| 144 | gzip_types application/vnd.apple.mpegurl video/f4m application/dash+xml text/xml;
|
|---|
| 145 | if ( $http_origin ~* (https?://(.+\.)?(fooobarr)$) ) {
|
|---|
| 146 | add_header Access-Control-Allow-Headers "origin,range,accept-encoding,referer" always;
|
|---|
| 147 | add_header Access-Control-Expose-Headers "Server,range,Content-Length,Content-Range" always;
|
|---|
| 148 | add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
|
|---|
| 149 | add_header Access-Control-Allow-Origin "$http_origin" always;
|
|---|
| 150 | }
|
|---|
| 151 | }
|
|---|
| 152 |
|
|---|
| 153 | location /bar/ {
|
|---|
| 154 | internal;
|
|---|
| 155 | access_log /var/log/nginx/stats.log.norotate debugmasked;
|
|---|
| 156 | alias /somewhere/;
|
|---|
| 157 | vod hls;
|
|---|
| 158 | vod_mode local;
|
|---|
| 159 | #vod_manifest_segment_durations_mode accurate;
|
|---|
| 160 | vod_align_segments_to_key_frames on;
|
|---|
| 161 | vod_bootstrap_segment_durations 5000;
|
|---|
| 162 | vod_segment_duration 10000;
|
|---|
| 163 |
|
|---|
| 164 | vod_hls_mpegts_interleave_frames on;
|
|---|
| 165 | vod_hls_mpegts_align_frames on;
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 | add_header Cache-Control "max-age=0, no-cache, no-store";
|
|---|
| 169 | if ( $http_origin ~* (https?://(.+\.)?(fooobarr)$) ) {
|
|---|
| 170 | add_header Access-Control-Allow-Headers "origin,range,accept-encoding,referer" always;
|
|---|
| 171 | add_header Access-Control-Expose-Headers "Server,range,Content-Length,Content-Range" always;
|
|---|
| 172 | add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
|
|---|
| 173 | add_header Access-Control-Allow-Origin "$http_origin" always;
|
|---|
| 174 | }
|
|---|
| 175 | }
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 | location /baz/ {
|
|---|
| 180 | access_log /var/log/nginx/stats.log.norotate debugmasked;
|
|---|
| 181 | alias /somewhere/;
|
|---|
| 182 | vod hls;
|
|---|
| 183 | vod_mode local;
|
|---|
| 184 | #vod_manifest_segment_durations_mode accurate;
|
|---|
| 185 | vod_align_segments_to_key_frames on;
|
|---|
| 186 | vod_bootstrap_segment_durations 5000;
|
|---|
| 187 | vod_segment_duration 10000;
|
|---|
| 188 |
|
|---|
| 189 | vod_hls_mpegts_interleave_frames on;
|
|---|
| 190 | vod_hls_mpegts_align_frames on;
|
|---|
| 191 |
|
|---|
| 192 | allow 127.0.0.1;
|
|---|
| 193 | deny all;
|
|---|
| 194 |
|
|---|
| 195 | add_header Cache-Control "max-age=0, no-cache, no-store";
|
|---|
| 196 |
|
|---|
| 197 | }
|
|---|
| 198 |
|
|---|
| 199 | location /boo/ {
|
|---|
| 200 | fastcgi_pass main;
|
|---|
| 201 | fastcgi_param SCRIPT_FILENAME /somewhere/somehting;
|
|---|
| 202 | fastcgi_param QUERY_STRING $query_string;
|
|---|
| 203 | fastcgi_param REQUEST_METHOD $request_method;
|
|---|
| 204 | fastcgi_param CONTENT_TYPE $content_type;
|
|---|
| 205 | fastcgi_param CONTENT_LENGTH $content_length;
|
|---|
| 206 | fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|---|
| 207 | fastcgi_param REQUEST_URI $request_uri;
|
|---|
| 208 | fastcgi_param DOCUMENT_URI $document_uri;
|
|---|
| 209 | fastcgi_param DOCUMENT_ROOT /somewhere;
|
|---|
| 210 | fastcgi_param SERVER_PROTOCOL $server_protocol;
|
|---|
| 211 | fastcgi_param HTTPS $https if_not_empty;
|
|---|
| 212 | fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
|---|
| 213 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
|---|
| 214 | fastcgi_param REMOTE_ADDR $remote_addr;
|
|---|
| 215 | fastcgi_param REMOTE_PORT $remote_port;
|
|---|
| 216 | fastcgi_param SERVER_ADDR $server_addr;
|
|---|
| 217 | fastcgi_param SERVER_PORT $server_port;
|
|---|
| 218 | fastcgi_param SERVER_NAME $server_name;
|
|---|
| 219 | fastcgi_param REDIRECT_STATUS 200;
|
|---|
| 220 | access_log /var/log/nginx/stats.log.norotate debugmasked;
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 | location /bee/ {
|
|---|
| 224 | alias /somewhere/;
|
|---|
| 225 | internal;
|
|---|
| 226 | access_log /var/log/nginx/stats.log.norotate debugmasked;
|
|---|
| 227 | }
|
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 |
|
|---|
| 231 | location /fee/ {
|
|---|
| 232 | root /somewhere;
|
|---|
| 233 | default_type image/jpeg;
|
|---|
| 234 | try_files $uri @tee;
|
|---|
| 235 | expires 365d;
|
|---|
| 236 | access_log off;
|
|---|
| 237 | }
|
|---|
| 238 |
|
|---|
| 239 | location @tee {
|
|---|
| 240 | fastcgi_pass main;
|
|---|
| 241 | fastcgi_param SCRIPT_FILENAME /somewhere/something;
|
|---|
| 242 | fastcgi_param QUERY_STRING $query_string;
|
|---|
| 243 | fastcgi_param REQUEST_METHOD $request_method;
|
|---|
| 244 | fastcgi_param CONTENT_TYPE $content_type;
|
|---|
| 245 | fastcgi_param CONTENT_LENGTH $content_length;
|
|---|
| 246 | fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|---|
| 247 | fastcgi_param REQUEST_URI $request_uri;
|
|---|
| 248 | fastcgi_param DOCUMENT_URI $document_uri;
|
|---|
| 249 | fastcgi_param DOCUMENT_ROOT /somewhere;
|
|---|
| 250 | fastcgi_param SERVER_PROTOCOL $server_protocol;
|
|---|
| 251 | fastcgi_param HTTPS $https if_not_empty;
|
|---|
| 252 | fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
|---|
| 253 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
|---|
| 254 | fastcgi_param REMOTE_ADDR $remote_addr;
|
|---|
| 255 | fastcgi_param REMOTE_PORT $remote_port;
|
|---|
| 256 | fastcgi_param SERVER_ADDR $server_addr;
|
|---|
| 257 | fastcgi_param SERVER_PORT $server_port;
|
|---|
| 258 | fastcgi_param SERVER_NAME $server_name;
|
|---|
| 259 | fastcgi_param REDIRECT_STATUS 200;
|
|---|
| 260 | access_log off;
|
|---|
| 261 | }
|
|---|
| 262 |
|
|---|
| 263 | location /tii {
|
|---|
| 264 | alias /somewhere/tii;
|
|---|
| 265 | internal;
|
|---|
| 266 | expires 365d;
|
|---|
| 267 | access_log off;
|
|---|
| 268 | }
|
|---|
| 269 |
|
|---|
| 270 | location = /too {
|
|---|
| 271 | add_header Access-Control-Allow-Headers "origin,range,accept-encoding,referer";
|
|---|
| 272 | add_header Access-Control-Expose-Headers "Server,range,Content-Length,Content-Range";
|
|---|
| 273 | add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS";
|
|---|
| 274 | add_header Access-Control-Allow-Origin "*";
|
|---|
| 275 | add_header Cache-Control "max-age=0, no-cache, no-store";
|
|---|
| 276 | access_log off;
|
|---|
| 277 | }
|
|---|
| 278 |
|
|---|
| 279 | location /server-status {
|
|---|
| 280 | stub_status on;
|
|---|
| 281 | access_log off;
|
|---|
| 282 | allow 127.0.0.1;
|
|---|
| 283 | deny all;
|
|---|
| 284 | }
|
|---|
| 285 |
|
|---|
| 286 | location /vod-status {
|
|---|
| 287 | vod_status;
|
|---|
| 288 | access_log off;
|
|---|
| 289 | allow 127.0.0.1;
|
|---|
| 290 | deny all;
|
|---|
| 291 | }
|
|---|
| 292 |
|
|---|
| 293 |
|
|---|
| 294 | }
|
|---|
| 295 |
|
|---|
| 296 | server {
|
|---|
| 297 | listen 85;
|
|---|
| 298 | location / {
|
|---|
| 299 | root /somewhere/;
|
|---|
| 300 | dav_methods PUT DELETE MKCOL COPY MOVE;
|
|---|
| 301 | create_full_put_path on;
|
|---|
| 302 | dav_access group:rw all:r;
|
|---|
| 303 | access_log off;
|
|---|
| 304 | }
|
|---|
| 305 | location = /asdad {
|
|---|
| 306 | alias /asdads;
|
|---|
| 307 | access_log off;
|
|---|
| 308 | }
|
|---|
| 309 | }
|
|---|
| 310 |
|
|---|
| 311 |
|
|---|
| 312 |
|
|---|
| 313 | }
|
|---|
| 314 |
|
|---|
| 315 |
|
|---|
| 316 | # configuration file /etc/nginx/mime.types:
|
|---|
| 317 | types {
|
|---|
| 318 | text/html html htm shtml;
|
|---|
| 319 | text/css css;
|
|---|
| 320 | text/xml xml;
|
|---|
| 321 | image/gif gif;
|
|---|
| 322 | image/jpeg jpeg jpg;
|
|---|
| 323 | application/x-javascript js;
|
|---|
| 324 | application/atom+xml atom;
|
|---|
| 325 | application/rss+xml rss;
|
|---|
| 326 |
|
|---|
| 327 | text/mathml mml;
|
|---|
| 328 | text/plain txt;
|
|---|
| 329 | text/vnd.sun.j2me.app-descriptor jad;
|
|---|
| 330 | text/vnd.wap.wml wml;
|
|---|
| 331 | text/x-component htc;
|
|---|
| 332 |
|
|---|
| 333 | image/png png;
|
|---|
| 334 | image/tiff tif tiff;
|
|---|
| 335 | image/vnd.wap.wbmp wbmp;
|
|---|
| 336 | image/x-icon ico;
|
|---|
| 337 | image/x-jng jng;
|
|---|
| 338 | image/x-ms-bmp bmp;
|
|---|
| 339 | image/svg+xml svg;
|
|---|
| 340 |
|
|---|
| 341 | application/java-archive jar war ear;
|
|---|
| 342 | application/mac-binhex40 hqx;
|
|---|
| 343 | application/msword doc;
|
|---|
| 344 | application/pdf pdf;
|
|---|
| 345 | application/postscript ps eps ai;
|
|---|
| 346 | application/rtf rtf;
|
|---|
| 347 | application/vnd.ms-excel xls;
|
|---|
| 348 | application/vnd.ms-powerpoint ppt;
|
|---|
| 349 | application/vnd.wap.wmlc wmlc;
|
|---|
| 350 | application/vnd.google-earth.kml+xml kml;
|
|---|
| 351 | application/vnd.google-earth.kmz kmz;
|
|---|
| 352 | application/x-7z-compressed 7z;
|
|---|
| 353 | application/x-cocoa cco;
|
|---|
| 354 | application/x-java-archive-diff jardiff;
|
|---|
| 355 | application/x-java-jnlp-file jnlp;
|
|---|
| 356 | application/x-makeself run;
|
|---|
| 357 | application/x-perl pl pm;
|
|---|
| 358 | application/x-pilot prc pdb;
|
|---|
| 359 | application/x-rar-compressed rar;
|
|---|
| 360 | application/x-redhat-package-manager rpm;
|
|---|
| 361 | application/x-sea sea;
|
|---|
| 362 | application/x-shockwave-flash swf;
|
|---|
| 363 | application/x-stuffit sit;
|
|---|
| 364 | application/x-tcl tcl tk;
|
|---|
| 365 | application/x-x509-ca-cert der pem crt;
|
|---|
| 366 | application/x-xpinstall xpi;
|
|---|
| 367 | application/xhtml+xml xhtml;
|
|---|
| 368 | application/zip zip;
|
|---|
| 369 |
|
|---|
| 370 | application/octet-stream bin exe dll;
|
|---|
| 371 | application/octet-stream deb;
|
|---|
| 372 | application/octet-stream dmg;
|
|---|
| 373 | application/octet-stream eot;
|
|---|
| 374 | application/octet-stream iso img;
|
|---|
| 375 | application/octet-stream msi msp msm;
|
|---|
| 376 |
|
|---|
| 377 | audio/midi mid midi kar;
|
|---|
| 378 | audio/mpeg mp3;
|
|---|
| 379 | audio/ogg ogg;
|
|---|
| 380 | audio/x-realaudio ra;
|
|---|
| 381 |
|
|---|
| 382 | video/3gpp 3gpp 3gp;
|
|---|
| 383 | video/mpeg mpeg mpg;
|
|---|
| 384 | video/mp4 mp4;
|
|---|
| 385 | video/quicktime mov;
|
|---|
| 386 | video/x-flv flv;
|
|---|
| 387 | video/x-mng mng;
|
|---|
| 388 | video/x-ms-asf asx asf;
|
|---|
| 389 | video/x-ms-wmv wmv;
|
|---|
| 390 | video/x-msvideo avi;
|
|---|
| 391 | }
|
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 |
|
|---|