-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
101 lines (79 loc) · 2.72 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
user nobody;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_processes auto;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
server_names_hash_bucket_size 64;
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
reset_timedout_connection on;
client_body_timeout 60;
client_max_body_size 20m;
keepalive_timeout 3;
keepalive_requests 100;
send_timeout 60;
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
# FastCGI setup
# Hopefully solving problems with occasional "502 Bad Gateway" errors
# Thanks to: http://jvdc.me/fix-502-bad-gateway-error-on-nginx-server-after-upgrading-php/
# http://stackoverflow.com/questions/23844761/upstream-sent-too-big-header-while-reading-response-header-from-upstream
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_index index.php;
# FastCGI cache setup
fastcgi_cache_path /var/cache/nginx/fastcgi levels=1:2 keys_zone=FASTCGI:1024m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503;
fastcgi_cache_lock on;
fastcgi_cache_revalidate off;
fastcgi_cache_min_uses 1; # from 2
# FastCGI cache usage (global)
fastcgi_cache FASTCGI;
fastcgi_cache_valid 10s;
add_header X-Cache $upstream_cache_status;
# Set correct character set
charset utf-8;
charset_types
application/javascript
application/json
application/x-javascript
application/xml
application/xml+rss
text/css
text/javascript
text/plain
text/xml
;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css text/xml application/javascript application/json application/x-javascript application/xml application/xml+rss text/javascript;
index index.php index.html index.htm;
include /etc/nginx/conf.d/*/*.conf;
}