-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathnginx.sample.conf
67 lines (54 loc) · 2.07 KB
/
nginx.sample.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
server {
set $host_path "/var/www/antragsgruen";
server_name antragsgruen.example.org;
root $host_path/web;
set $yii_bootstrap "index.php";
# Letsencrypt SSL configuration
listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/antragsgruen.example.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/antragsgruen.example.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
client_max_body_size 32M;
charset utf-8;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
rewrite ^/(.*)/$ /$1 permanent;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
location ~ \.(js|woff|woff2)$ {
expires 7d;
}
location ~ \/web.*(css|png|jpg)$ {
expires 7d;
}
location /favicons {
expires 7d;
}
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_read_timeout 1200;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
#let yii catch the calls to unexising PHP files
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
fastcgi_pass unix:/var/run/php8-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
}