-
Notifications
You must be signed in to change notification settings - Fork 10
/
nginx.conf
84 lines (62 loc) · 1.96 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
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
passenger_root /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17;
passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby;
passenger_max_pool_size 4;
passenger_friendly_error_pages off;
passenger_pre_start http://chaoskeh.com/;
include mime.types;
default_type application/octet-stream;
# hide server info
server_tokens off;
more_clear_headers 'Server' 'X-Powered-By';
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
send_timeout 20s;
gzip on;
gzip_min_length 640;
gzip_types application/rss+xml application/json;
server {
set $server_host "chaoskeh.com";
set $server_root "/home/klog/public";
listen 80;
server_name $server_host;
root $server_root;
passenger_enabled on;
add_header X-UA-Compatible "IE=Edge,chrome=1";
#subdomain 301 to non-www domain
if ($host != $server_host) {
rewrite ^/(.*)$ http://${server_host}/$1 permanent;
}
location ~ ^/assets/ {
root $server_root;
gzip_static on;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
location ~ ^/uploads/ {
root $server_root;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
}
}