-
-
Notifications
You must be signed in to change notification settings - Fork 92
/
nginx-docker.conf
70 lines (55 loc) · 1.84 KB
/
nginx-docker.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
server {
listen 0.0.0.0:80;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/public;
index index.php index.html;
error_page 404 /index.php;
set $skip_cache 0;
set $cache_uri $request_uri;
if ($query_string != "") {
set $skip_cache 1;
set $cache_uri null;
}
# Don't cache uris containing the following segments
if ($request_uri ~* "/admin/|/user/|/cart/|/feed/|index.php|sitemap(_index)?.xml") {
set $skip_cache 1;
set $cache_uri null;
}
# Don't use the cache for logged in users or if products in cart
if ($http_cookie ~* "nocache|cart|user") {
set $skip_cache 1;
set $cache_uri null;
}
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $skip_cache 1;
set $cache_uri null;
}
#static files
location ~* "\.(?!php)([\w]{3,4})$" {
expires max;
log_not_found off;
sendfile on;
sendfile_max_chunk 1m;
fastcgi_hide_header "Set-Cookie";
try_files $uri =404;
}
location / {
default_type text/html;
index index.php index.html index.htm;
try_files /page-cache/$http_host$cache_uri /page-cache/$http_host$cache_uri/index.html $uri $uri/ /index.php$is_args$args;
#try_files $uri $uri/ /index.php$is_args$args;
#cache debug
#add_header "uri" $cache_uri;
}
location ~ \.php$ {
# try_files $uri =404;
#fastcgi_pass unix:/var/run/php-fpm83/php-fpm.pid;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}