-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
130 lines (94 loc) · 3.08 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
# user and group to run as
user www www;
# number of nginx workers
worker_processes 6;
# pid of nginx master process
pid /var/run/nginx.pid;
# Number of worker connections. 1024 is a good default
events {
worker_connections 1024;
}
# start the http module where we config http access.
http {
# pull in mime-types. You can break out your config
# into as many include's as you want to make it cleaner
include /usr/local/etc/nginx/mime.types;
# set a default type for the rare situation that
# nothing matches from the mimie-type include
# default_type application/octet-stream;
# configure log format
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# main access log
access_log /var/log/nginx_access.log main;
# main error log
error_log /var/log/nginx_error.log debug;
# no sendfile on OSX
sendfile on;
upload_progress uploads 15m;
# These are good default values.
tcp_nopush on;
tcp_nodelay off;
# output compression saves bandwidth
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
# gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
upstream thin {
server 127.0.0.1:5000;
server 127.0.0.1:5001;
server 127.0.0.1:5002;
}
server {
# port to listen on. Can also be set to an IP:PORT
listen 80;
# Set the max size for file uploads to 50Mb
client_max_body_size 2048M;
# doc root
root /Users/n3mfis/Project/rails/ccn.dev/public;
location @frontcontroller {
rewrite ^ /uploader last;
}
location = /progress {
report_uploads uploads;
}
location = /upload {
upload_pass_args on;
upload_tame_arrays on;
upload_pass @frontcontroller;
upload_store /var/tmp/uploaders;
upload_store_access user:r group:r all:r;
upload_set_form_field "values" "[ tmp=$upload_tmp_path, type=$upload_content_type, filename=$upload_file_name ]";
upload_aggregate_form_field "sizes" "[, md5=$upload_file_md5, size=$upload_file_size ]";
track_uploads uploads 5s;
}
location / {
# needed to forward user's IP address to rails
proxy_set_header X-Real-IP $remote_addr;
# needed for HTTPS
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
# proxy_redirect false;
proxy_max_temp_file_size 0;
if (-f $request_filename) {
break;
}
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://thin;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /Users/n3mfis/Project/rails/ccn.dev/public;
}
}
}