-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx-default.conf
70 lines (55 loc) · 1.9 KB
/
nginx-default.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
# TODO: more details on `fastcgi_cache`
# pass https on for Laravel isSecure/asset
map $http_x_forwarded_proto $fastcgi_param_https_variable {
default '';
https 'on';
}
server {
listen 80; #ipv4
server_name _; #catch-all
root /usr/share/nginx/html/;
index index.php index.html;
set $skip_cache 0;
if ($request_method = POST) {
set $skip_cache 1;
}
client_max_body_size 5M;
# Client IP Handling for AWS ELB
set_real_ip_from 10.0.0.0/16;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
location / {
try_files $uri $uri/ /index.php?$query_string;
# Client IP Handling for AWS ELB
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;
}
location ~ \.php$ {
root /www;
fastcgi_cache dwchiang;
fastcgi_cache_valid 200 204 60m;
fastcgi_ignore_headers Cache-Control;
fastcgi_no_cache $skip_cache $http_authorization $cookie_laravel_session;
fastcgi_cache_lock on;
fastcgi_cache_lock_timeout 10s;
fastcgi_buffer_size 6144;
add_header X-Proxy-Cache $upstream_cache_status;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS $fastcgi_param_https_variable;
fastcgi_read_timeout 900s;
include fastcgi_params;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|ttf|woff|woff2)$ {
expires max;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
access_log off;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /\.ht {
deny all;
}
}