-
Notifications
You must be signed in to change notification settings - Fork 29
/
.nginx.conf
90 lines (70 loc) · 2.97 KB
/
.nginx.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
server {
root /var/www/farm.army/htdocs/public;
server_name farm.army;
gzip on;
gzip_types text/plain application/xml application/json application/javascript text/css;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 1000;
location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# optionally set the value of the environment variables used in the application
# fastcgi_param APP_ENV prod;
# fastcgi_param APP_SECRET <app-secret-id>;
# fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# 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;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
location /assets/ {
try_files $uri /var/www/farm.army/htdocs/public;
expires 30d;
add_header Cache-Control "public, no-transform";
}
location /token/ {
try_files $uri /var/www/farm.army/htdocs/public;
expires 30d;
add_header Cache-Control "public, no-transform";
}
listen [::]:443 ssl http2 ipv6only=on; # managed by Certbot
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/farm.army/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/farm.army/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
error_log /var/www/farm.army/logs/error.log;
access_log /var/www/farm.army/logs/access.log;
}
server {
if ($host = www.farm.army) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = farm.army) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name www.farm.army farm.army;
rewrite ^(.*) http://farm.army$1 permanent;
return 404; # managed by Certbot
}