-
Notifications
You must be signed in to change notification settings - Fork 5
/
nginx_index_site
67 lines (54 loc) · 2.6 KB
/
nginx_index_site
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
# First, make sure that NGINX' `mime.types` file includes 'image/webp webp'
include /etc/nginx/mime.types;
# Checking if HTTP's `ACCEPT` header contains 'webp'
# if not supported - just download uri
# if supported - define path that cant be found .. fallback will be webp converter
map $http_accept $handle_webp {
default $uri;
"~*webp" "use_webp_fallback";
}
server {
listen 443 ssl;
listen [::]:443 ssl;
client_max_body_size 768M;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM;
fastcgi_param HTTPS on;
root /var/www/index/;
server_name web-test.catrobat.org;
location ~* ^.+\.(jpe?g|png) {
# images should be served in webp format if supported by client
set $args $args&source=$document_root$fastcgi_script_name;
try_files $handle_webp /webp-on-demand.php$is_args$args;
}
location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}
location ~ \.php(/|$) {
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
fastcgi_param HTTP_SCHEME https;
keepalive_timeout 90;
fastcgi_buffers 32 4k;
fastcgi_buffer_size 32k;
send_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/index.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
access_log /var/log/nginx/access.log combined;
error_log /var/log/nginx/error.log warn;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
}