| 1 | # configuration file /etc/nginx/nginx.conf:
|
|---|
| 2 | #user nginx;
|
|---|
| 3 | user root;
|
|---|
| 4 | worker_processes 1;
|
|---|
| 5 | worker_rlimit_nofile 4000;
|
|---|
| 6 | error_log /var/log/nginx/error.log;
|
|---|
| 7 | include /usr/share/nginx/modules/*.conf;
|
|---|
| 8 | events {
|
|---|
| 9 | worker_connections 2000;
|
|---|
| 10 | }
|
|---|
| 11 | http {
|
|---|
| 12 | log_format main '$remote_addr - $remote_user [$time_iso8601] "rt: $request_time" "$request" '
|
|---|
| 13 | '$status $body_bytes_sent "$http_referer" '
|
|---|
| 14 | '"$http_user_agent" "$http_x_forwarded_for" "$http_host"';
|
|---|
| 15 | access_log /var/log/nginx/access.log main;
|
|---|
| 16 | charset UTF-8;
|
|---|
| 17 | sendfile on;
|
|---|
| 18 | tcp_nopush on;
|
|---|
| 19 | tcp_nodelay on;
|
|---|
| 20 | keepalive_requests 0;
|
|---|
| 21 | keepalive_timeout 0;
|
|---|
| 22 | server_tokens off;
|
|---|
| 23 | include /etc/nginx/mime.types;
|
|---|
| 24 | default_type text/html;
|
|---|
| 25 | include /etc/nginx/conf.d/*.conf;
|
|---|
| 26 | server {
|
|---|
| 27 | listen 80 default_server;
|
|---|
| 28 | add_header my-trace "$hostname-abcd" always;
|
|---|
| 29 | return 404 "<!DOCTYPE html><html><head><title>https</title><link rel=\"icon\" href=\"data:,\"></head><body>https</body></html>";
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
| 32 | stream {
|
|---|
| 33 | map $ssl_preread_server_name $backend {
|
|---|
| 34 | hostnames;
|
|---|
| 35 | .mydomain.org workhorse;
|
|---|
| 36 | default stub;
|
|---|
| 37 | }
|
|---|
| 38 | upstream workhorse {
|
|---|
| 39 | server 10.10.10.10:443;
|
|---|
| 40 | }
|
|---|
| 41 | upstream stub {
|
|---|
| 42 | server 127.0.0.1:9044 down;
|
|---|
| 43 | }
|
|---|
| 44 | log_format basic '[$time_iso8601] $remote_addr:$remote_port ($ssl_preread_server_name -> $backend) '
|
|---|
| 45 | '$ssl_preread_protocol "$ssl_preread_alpn_protocols" $protocol $status '
|
|---|
| 46 | '$bytes_sent $bytes_received $session_time';
|
|---|
| 47 | access_log /var/log/nginx/stream-access.log basic;
|
|---|
| 48 | error_log /var/log/nginx/stream-error.log warn;
|
|---|
| 49 | server {
|
|---|
| 50 | listen 443;
|
|---|
| 51 | proxy_bind $remote_addr transparent;
|
|---|
| 52 | ssl_preread on;
|
|---|
| 53 | proxy_connect_timeout 4s;
|
|---|
| 54 | proxy_pass $backend;
|
|---|
| 55 | }
|
|---|
| 56 | }
|
|---|
| 57 | # configuration file /etc/nginx/mime.types:
|
|---|
| 58 | types {
|
|---|
| 59 | text/html html htm shtml;
|
|---|
| 60 | text/css css;
|
|---|
| 61 | text/xml xml;
|
|---|
| 62 | image/gif gif;
|
|---|
| 63 | image/jpeg jpeg jpg;
|
|---|
| 64 | application/javascript js;
|
|---|
| 65 | application/atom+xml atom;
|
|---|
| 66 | application/rss+xml rss;
|
|---|
| 67 | text/mathml mml;
|
|---|
| 68 | text/plain txt;
|
|---|
| 69 | text/vnd.sun.j2me.app-descriptor jad;
|
|---|
| 70 | text/vnd.wap.wml wml;
|
|---|
| 71 | text/x-component htc;
|
|---|
| 72 | image/png png;
|
|---|
| 73 | image/svg+xml svg svgz;
|
|---|
| 74 | image/tiff tif tiff;
|
|---|
| 75 | image/vnd.wap.wbmp wbmp;
|
|---|
| 76 | image/webp webp;
|
|---|
| 77 | image/x-icon ico;
|
|---|
| 78 | image/x-jng jng;
|
|---|
| 79 | image/x-ms-bmp bmp;
|
|---|
| 80 | font/woff woff;
|
|---|
| 81 | font/woff2 woff2;
|
|---|
| 82 | application/java-archive jar war ear;
|
|---|
| 83 | application/json json;
|
|---|
| 84 | application/mac-binhex40 hqx;
|
|---|
| 85 | application/msword doc;
|
|---|
| 86 | application/pdf pdf;
|
|---|
| 87 | application/postscript ps eps ai;
|
|---|
| 88 | application/rtf rtf;
|
|---|
| 89 | application/vnd.apple.mpegurl m3u8;
|
|---|
| 90 | application/vnd.google-earth.kml+xml kml;
|
|---|
| 91 | application/vnd.google-earth.kmz kmz;
|
|---|
| 92 | application/vnd.ms-excel xls;
|
|---|
| 93 | application/vnd.ms-fontobject eot;
|
|---|
| 94 | application/vnd.ms-powerpoint ppt;
|
|---|
| 95 | application/vnd.oasis.opendocument.graphics odg;
|
|---|
| 96 | application/vnd.oasis.opendocument.presentation odp;
|
|---|
| 97 | application/vnd.oasis.opendocument.spreadsheet ods;
|
|---|
| 98 | application/vnd.oasis.opendocument.text odt;
|
|---|
| 99 | application/vnd.openxmlformats-officedocument.presentationml.presentation
|
|---|
| 100 | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
|---|
| 101 | application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
|---|
| 102 | application/vnd.wap.wmlc wmlc;
|
|---|
| 103 | application/x-7z-compressed 7z;
|
|---|
| 104 | application/x-cocoa cco;
|
|---|
| 105 | application/x-java-archive-diff jardiff;
|
|---|
| 106 | application/x-java-jnlp-file jnlp;
|
|---|
| 107 | application/x-makeself run;
|
|---|
| 108 | application/x-perl pl pm;
|
|---|
| 109 | application/x-pilot prc pdb;
|
|---|
| 110 | application/x-rar-compressed rar;
|
|---|
| 111 | application/x-redhat-package-manager rpm;
|
|---|
| 112 | application/x-sea sea;
|
|---|
| 113 | application/x-shockwave-flash swf;
|
|---|
| 114 | application/x-stuffit sit;
|
|---|
| 115 | application/x-tcl tcl tk;
|
|---|
| 116 | application/x-x509-ca-cert der pem crt;
|
|---|
| 117 | application/x-xpinstall xpi;
|
|---|
| 118 | application/xhtml+xml xhtml;
|
|---|
| 119 | application/xspf+xml xspf;
|
|---|
| 120 | application/zip zip;
|
|---|
| 121 | application/octet-stream bin exe dll;
|
|---|
| 122 | application/octet-stream deb;
|
|---|
| 123 | application/octet-stream dmg;
|
|---|
| 124 | application/octet-stream iso img;
|
|---|
| 125 | application/octet-stream msi msp msm;
|
|---|
| 126 | audio/midi mid midi kar;
|
|---|
| 127 | audio/mpeg mp3;
|
|---|
| 128 | audio/ogg ogg;
|
|---|
| 129 | audio/x-m4a m4a;
|
|---|
| 130 | audio/x-realaudio ra;
|
|---|
| 131 | video/3gpp 3gpp 3gp;
|
|---|
| 132 | video/mp2t ts;
|
|---|
| 133 | video/mp4 mp4;
|
|---|
| 134 | video/mpeg mpeg mpg;
|
|---|
| 135 | video/quicktime mov;
|
|---|
| 136 | video/webm webm;
|
|---|
| 137 | video/x-flv flv;
|
|---|
| 138 | video/x-m4v m4v;
|
|---|
| 139 | video/x-mng mng;
|
|---|
| 140 | video/x-ms-asf asx asf;
|
|---|
| 141 | video/x-ms-wmv wmv;
|
|---|
| 142 | video/x-msvideo avi;
|
|---|
| 143 | }
|
|---|