-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathnginx.conf
168 lines (155 loc) · 4.97 KB
/
nginx.conf
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#*****************************
# Enviroment Variables
#*****************************
env PATH;
env ADMIN_PASSWORD;
env SMTP_ADDRESS;
env SMTP_PORT;
env SMTP_USER;
env SMTP_PASS;
env SMTP_TTLS;
env SMTP_AUTH;
env AWS_ACCESS_KEY_ID;
env AWS_SECRET_ACCESS_KEY;
env AWS_DEFAULT_IMAGE_BUCKET;
env TWITTER_CONSUMER_KEY;
env TWITTER_CONSUMER_SECRET;
env FACEBOOK_APP_ID;
env FACEBOOK_APP_SECRET;
env GOOGLE_CLIENT_ID;
env GOOGLE_CLIENT_SECRET;
env APNS_PEM_PATH;
env APNS_PEM_PASS;
env GCM_KEY;
env REDIS_URL;
env API_URL;
env WEB_URL;
env MAIL_HEADER_IMAGE;
env MAIL_CUSTOM_GREETINGS;
env MAIL_CUSTOM_GREETING_MESSAGE;
env PUBLIC_WEB_URL;
env ASSET_HOST_URL;
env NEW_RELIC_LICENSE_KEY;
env NEW_RELIC_APP_NAME;
env RACK_ENV;
env RAILS_ENV;
env DATABASE_URL;
env PORT;
env SENDGRID_PASS;
env SENDGRID_USER;
env REDIS_IP;
env REDIS_PORT;
env SWAGGER_APP_URL;
env WEBHOOK_URL;
env APPSIGNAL_APP_NAME;
env APPSIGNAL_PUSH_API_KEY;
env LIMIT_CITY_BOUNDARIES;
env GEOCODM;
env SENTRY_DSN_URL;
env DISABLE_MEMORY_CACHE;
#*****************************
# Process configuration
#*****************************
user root;
worker_processes 4;
pid /run/nginx.pid;
daemon off;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
}
http {
#*****************************
# Request Processing Settings
#*****************************
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/conf.d/*.conf;
server_names_hash_bucket_size 64;
include /opt/nginx/conf/mime.types;
default_type application/octet-stream;
# This must be increased should the application ever be used to upload large files
client_max_body_size 30m;
large_client_header_buffers 4 16k;
#*****************************
# Logging Settings
#*****************************
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
#*****************************
# Gzip Settings
#*****************************
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 16k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/x-json application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
#*****************************
# Passenger settings
#*****************************
passenger_root "PASSENGER_ROOT";
passenger_ruby /usr/local/bin/ruby;
passenger_max_pool_size 4;
passenger_min_instances 4;
passenger_pool_idle_time 300;
# This should be a lesser privileged user but its being run as root due to issues with docker and volumes
passenger_user_switching off;
passenger_default_user root;
server {
listen 80 default_server;
server_name _;
root /usr/src/app/public;
passenger_enabled on;
#*****************************
# Adds CORS headers
#*****************************
# The application does not insert CORS headers, so it must be set by the web server
location / {
if ($request_method != 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PATCH, PUT, DELETE' always;
# These should be changed should the application remove or add another reader
add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-App-Token,X-App-Namespace,total,per-page' always;
add_header 'Access-Control-Expose-Headers' 'X-App-Token,X-App-Namespace,total,per-page' always;
}
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PATCH, PUT, DELETE';
# These should be changed should the application remove or add another reader
add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-App-Token,X-App-Namespace,total,per-page';
add_header 'Access-Control-Expose-Headers' 'X-App-Token,X-App-Namespace,total,per-page';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
location /cubes/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:8085/;
}
location = /favicon.ico {
expires max;
add_header Cache-Control public;
}
location ~ ^/(uploads|assets|images|javascripts|stylesheets|swfs|system)/ {
gzip_static on;
expires max;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
break;
}
}
}