-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnginx.conf
71 lines (56 loc) · 2.39 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
events {
}
http {
# add default mappings for mime types
include mime.types;
log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name to: $upstream_addr: $request upstream_response_time $upstream_response_time msec $msec request_time $request_time';
# It's always good to set logs, note however you cannot turn off the error log
# setting error_log off; will simply create a file called 'off'.
error_log /var/log/nginx/error.log crit;
# It is best to place the root of the server block at the server level, and not the location level
# any location block path will be relative to this root.
root /usr/share/www/;
# optimization when serving static files
sendfile on;
sendfile_max_chunk 1m;
# disable sending nginx server version in header
server_tokens off;
## Start: Size Limits & Buffer Overflows ##
client_body_buffer_size 4K;
client_header_buffer_size 1k;
client_max_body_size 1k;
large_client_header_buffers 2 6k;
## END: Size Limits & Buffer Overflows ##
## Start: Timeouts ##
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 5 5;
send_timeout 10;
## End: Timeouts ##
server {
# no need for root privileges
listen 80;
server_name localhost;
#proxy_buffering on
#proxy_buffers 32 16k; # controls the size and the number of buffers allocated for a request
proxy_buffer_size 4k; # first part of the response from a proxied server stored in this buffer
proxy_set_header X-Real-IP $remote_addr; # set to the IP address of the client
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # a list containing the IP addresses of every server the client has been proxied through
proxy_ssl_verify off; # REMOVE ME!!!!
client_max_body_size 20M;
# The modifier ^~ in the following location block results in a case sensitive regular expression match.
# Therefore the URI /images or /images/logo.png will be matched but stops searching as soon as a match is found.
location / {
access_log off;
log_not_found off;
# limit methods
limit_except GET HEAD { deny all; }
}
location ~* \.(jpg|jpeg|gif|png|svg|webp|eot|otf|ttf|ttc|woff|woff2|font.css|css|js)$ {
add_header Cache-Control "public, max-age=31536000";
}
location ~* \.(html|htm)$ {
add_header Cache-Control "public, max-age=30";
}
}
}