-
-
Notifications
You must be signed in to change notification settings - Fork 92
/
nginx-live.conf
executable file
·154 lines (124 loc) · 4.64 KB
/
nginx-live.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#replace /var/www/vvveb/public with your vvveb website public folder and set server_name for your domain
#copy this file to /etc/nginx/sites-available/vvveb
#sudo ln -s /etc/nginx/sites-available/vvveb /etc/nginx/sites-enabled/vvveb
# or for apline linux /etc/nginx/httpd.d/default.conf
upstream php {
server unix:/var/run/php/php-fpm.sock;
#server unix:/var/run/php-fpm82/php-fpm.pid;#alpine
#server 127.0.0.1:9000;
}
upstream php81 {
server unix:/var/run/php/php8.1-fpm.sock;
#server 127.0.0.1:9000;
}
upstream php82 {
server unix:/var/run/php/php8.2-fpm.sock;
server unix:/var/run/php-fpm82.pid;#alpine
#server 127.0.0.1:9000;
}
upstream php74 {
server unix:/var/run/php/php7.4-fpm.sock;
#server 127.0.0.1:9000;
}
#use fastcgi cache if you want an even faster cache by mapping to memory otherwise leave it disabled to use the default try_files file cache
fastcgi_cache_path /var/run/nginx-vvveb_cache levels=1:2 keys_zone=VCACHE:100m inactive=30m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
server {
#always use public folder as root for security
root /var/www/vvveb/public;
#replace vvveb.net with your domain
#server_name *.vvveb.net vvveb.net;
#listen 80 server;
#listen [::]:80 server;
#listen 443 ssl http2;
#listen [::]:443 ssl http2;
#ssl_certificate /etc/letsencrypt/live/vvveb.com/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/vvveb.com/privkey.pem;
#ssl_session_cache shared:SSL:20m;
#ssl_session_timeout 10m;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_prefer_server_ciphers on;
#ssl_ciphers 'ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5';
#error_log /var/log/nginx/error.log debug;
gzip on;
gzip_vary on;
gzip_min_length 10240;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
#charset utf-8;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
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|user|cart") {
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;
}
#index index.html index.htm index.php;
#error_page 404 /index.php;
#error_page 404 /404.html;
#add domain to sitemaps for multisite
location = /robots.txt {
log_not_found off;
access_log off;
try_files $uri /index.php$is_args$args;
}
#static files
location ~* "\.(?!php)([\w]{3,5})$" {
expires max;
log_not_found off;
sendfile on;
sendfile_max_chunk 1m;
fastcgi_hide_header "Set-Cookie";
}
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;
#add_header "skip_cache" $skip_cache;
}
location ~ /media/.+?\.php$ {
deny all;
}
location ~ \.php$ {
#fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
#fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
include fastcgi.conf;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
#uncomment fastcgi_cache to enable fastcgi cache, this should not be necessary
#unless you set the path to a memory mapped location for even faster cache
#fastcgi_cache VCACHE;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache_valid 30m;
#add_header X-VCache $upstream_cache_status;
}
location ~ /\.(?!well-known).* {
deny all;
}
}