-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
83 lines (69 loc) · 2.09 KB
/
nginx.conf
File metadata and controls
83 lines (69 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#user nobody;
worker_processes 1;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
# DO NOT RESPOND TO REQUESTS OTHER THAN yourdomain.com
# server {
# listen 80 default;
# server_name _;
# return 444;
# }
# FILE UPLOADS
server {
listen 80;
#listen 443 ssl;
server_name ec2-50-17-84-140.compute-1.amazonaws.com;
#ssl_certificate /etc/nginx/server.crt;
#ssl_certificate_key /etc/nginx/server.key;
#ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;
access_log /var/log/nginx/s3uploadproxy.access.log;
error_log /var/log/nginx/s3uploadproxy.error.log;
proxy_read_timeout 10;
proxy_connect_timeout 10;
client_max_body_size 30M;
# slow uploads
proxy_send_timeout 1200;
# Deny illegal Host headers
#if ($host !~* ^(yourdomain.com|www.yourdomain.com)$ ) {
# return 444;
#}
# dissalow methods
if ($request_method !~ ^(OPTIONS|POST|GET)$ ) {
# empty response
return 444;
}
location / {
# CORS PRE-FLIGHT REQUESTS
if ($request_method = 'OPTIONS') {
more_set_headers 'Access-Control-Allow-Origin: *';
more_set_headers 'Access-Control-Allow-Methods: POST, OPTIONS';
more_set_headers 'Access-Control-Max-Age: 1728000';
more_set_headers 'Content-Type: text/plain; charset=UTF-8';
more_set_headers 'Access-Control-Allow-Headers: origin, content-type';
return 200;
}
# FILE UPLOADS
if ($request_method = 'POST') {
more_set_headers 'Access-Control-Allow-Origin: *';
proxy_pass https://s3.amazonaws.com;
}
if ($request_method = 'GET') {
more_set_headers 'Access-Control-Allow-Origin: *';
proxy_pass https://s3.amazonaws.com;
}
}
# 204 (No Content) for favicon.ico
location = /favicon.ico {
#empty_gif;
return 204;
}
}
}