| 1 |
|
|---|
| 2 | #user nobody;
|
|---|
| 3 | worker_processes 1;
|
|---|
| 4 | daemon off;
|
|---|
| 5 |
|
|---|
| 6 | #error_log logs/error.log;
|
|---|
| 7 | #error_log logs/error.log notice;
|
|---|
| 8 | error_log logs/error.log debug;
|
|---|
| 9 |
|
|---|
| 10 | #pid logs/nginx.pid;
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 | events {
|
|---|
| 14 | worker_connections 1024;
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | http {
|
|---|
| 19 | include mime.types;
|
|---|
| 20 | default_type application/octet-stream;
|
|---|
| 21 |
|
|---|
| 22 | #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|---|
| 23 | # '$status $body_bytes_sent "$http_referer" '
|
|---|
| 24 | # '"$http_user_agent" "$http_x_forwarded_for"';
|
|---|
| 25 |
|
|---|
| 26 | #access_log logs/access.log main;
|
|---|
| 27 |
|
|---|
| 28 | sendfile on;
|
|---|
| 29 | #tcp_nopush on;
|
|---|
| 30 |
|
|---|
| 31 | #keepalive_timeout 0;
|
|---|
| 32 | keepalive_timeout 65;
|
|---|
| 33 |
|
|---|
| 34 | #gzip on;
|
|---|
| 35 |
|
|---|
| 36 | upstream s3 {
|
|---|
| 37 | server s3.amazonaws.com:443;
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | server {
|
|---|
| 41 | listen 80;
|
|---|
| 42 | server_name localhost;
|
|---|
| 43 |
|
|---|
| 44 | #charset koi8-r;
|
|---|
| 45 |
|
|---|
| 46 | #access_log logs/host.access.log main;
|
|---|
| 47 |
|
|---|
| 48 | location / {
|
|---|
| 49 | root html;
|
|---|
| 50 | index index.html index.htm;
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | #error_page 404 /404.html;
|
|---|
| 54 |
|
|---|
| 55 | # redirect server error pages to the static page /50x.html
|
|---|
| 56 | #
|
|---|
| 57 | error_page 500 502 503 504 /50x.html;
|
|---|
| 58 | location = /50x.html {
|
|---|
| 59 | root html;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | # proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
|---|
| 63 | #
|
|---|
| 64 | #location ~ \.php$ {
|
|---|
| 65 | # proxy_pass http://127.0.0.1;
|
|---|
| 66 | #}
|
|---|
| 67 |
|
|---|
| 68 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
|---|
| 69 | #
|
|---|
| 70 | #location ~ \.php$ {
|
|---|
| 71 | # root html;
|
|---|
| 72 | # fastcgi_pass 127.0.0.1:9000;
|
|---|
| 73 | # fastcgi_index index.php;
|
|---|
| 74 | # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
|---|
| 75 | # include fastcgi_params;
|
|---|
| 76 | #}
|
|---|
| 77 |
|
|---|
| 78 | # deny access to .htaccess files, if Apache's document root
|
|---|
| 79 | # concurs with nginx's one
|
|---|
| 80 | #
|
|---|
| 81 | #location ~ /\.ht {
|
|---|
| 82 | # deny all;
|
|---|
| 83 | #}
|
|---|
| 84 | location /files {
|
|---|
| 85 | # Prevent Amazon from overwriting our Headers.
|
|---|
| 86 | proxy_hide_header Content-Type;
|
|---|
| 87 | proxy_hide_header ETag;
|
|---|
| 88 |
|
|---|
| 89 | # Hide Amazon Headers
|
|---|
| 90 | proxy_hide_header X-Amz-Id-2;
|
|---|
| 91 | proxy_hide_header X-Amz-Request-Id;
|
|---|
| 92 |
|
|---|
| 93 | # Set the HTTP Host header to S3.
|
|---|
| 94 | proxy_set_header Host 's3.amazonaws.com';
|
|---|
| 95 |
|
|---|
| 96 | # Force Amazon to do the heavy lifting.
|
|---|
| 97 | proxy_buffering off;
|
|---|
| 98 |
|
|---|
| 99 | # Ensure tight timeouts, we'll retry the requests to a different backend in
|
|---|
| 100 | # the event of failures.
|
|---|
| 101 | proxy_connect_timeout 5;
|
|---|
| 102 | proxy_send_timeout 10;
|
|---|
| 103 | proxy_read_timeout 10;
|
|---|
| 104 |
|
|---|
| 105 | # Retry if Amazon freaks out.
|
|---|
| 106 | proxy_next_upstream error timeout http_500 http_502 http_503 http_504;
|
|---|
| 107 |
|
|---|
| 108 | # Ensure the requests are always gets.
|
|---|
| 109 | proxy_method GET;
|
|---|
| 110 | proxy_set_header Method 'GET';
|
|---|
| 111 | proxy_set_header Content-Length "";
|
|---|
| 112 | proxy_set_header Cookie "";
|
|---|
| 113 | proxy_set_header Content-Type "";
|
|---|
| 114 |
|
|---|
| 115 | # Clear any CloudFront headers.
|
|---|
| 116 | proxy_set_header X-Amz-Cf-Id "";
|
|---|
| 117 |
|
|---|
| 118 | # We use the query string for Authorization, clear headers that the client
|
|---|
| 119 | # may have sent.
|
|---|
| 120 | proxy_set_header Authorization "";
|
|---|
| 121 |
|
|---|
| 122 | proxy_ssl_verify_peer on;
|
|---|
| 123 | proxy_ssl_verify_depth 4;
|
|---|
| 124 | proxy_ssl_ca_certificate "/Users/Andrew/local/nginx/conf/bad.pem";
|
|---|
| 125 |
|
|---|
| 126 | # Proxy to S3.
|
|---|
| 127 | proxy_pass https://s3/;
|
|---|
| 128 | }
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 | # another virtual host using mix of IP-, name-, and port-based configuration
|
|---|
| 133 | #
|
|---|
| 134 | #server {
|
|---|
| 135 | # listen 8000;
|
|---|
| 136 | # listen somename:8080;
|
|---|
| 137 | # server_name somename alias another.alias;
|
|---|
| 138 |
|
|---|
| 139 | # location / {
|
|---|
| 140 | # root html;
|
|---|
| 141 | # index index.html index.htm;
|
|---|
| 142 | # }
|
|---|
| 143 | #}
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 | # HTTPS server
|
|---|
| 147 | #
|
|---|
| 148 | #server {
|
|---|
| 149 | # listen 443;
|
|---|
| 150 | # server_name localhost;
|
|---|
| 151 |
|
|---|
| 152 | # ssl on;
|
|---|
| 153 | # ssl_certificate cert.pem;
|
|---|
| 154 | # ssl_certificate_key cert.key;
|
|---|
| 155 |
|
|---|
| 156 | # ssl_session_timeout 5m;
|
|---|
| 157 |
|
|---|
| 158 | # ssl_protocols SSLv2 SSLv3 TLSv1;
|
|---|
| 159 | # ssl_ciphers HIGH:!aNULL:!MD5;
|
|---|
| 160 | # ssl_prefer_server_ciphers on;
|
|---|
| 161 |
|
|---|
| 162 | # location / {
|
|---|
| 163 | # root html;
|
|---|
| 164 | # index index.html index.htm;
|
|---|
| 165 | # }
|
|---|
| 166 | #}
|
|---|
| 167 |
|
|---|
| 168 | }
|
|---|