1
0
Fork 0
mirror of https://github.com/Findus23/devicedetector.net.git synced 2024-09-19 15:43:46 +02:00

add nginx config

This commit is contained in:
Lukas Winkler 2019-09-13 19:09:53 +02:00
parent 4d6f0040db
commit 7255de71bc
Signed by: lukas
GPG key ID: 54DE4D798D244853

40
nginx.conf Normal file
View file

@ -0,0 +1,40 @@
limit_req_zone $binary_remote_addr zone=ddlimit:10m rate=1r/m;
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name devicedetector.lw1.at;
access_log /var/log/nginx/devicedetector.lw1.at.access.log;
error_log /var/log/nginx/devicedetector.lw1.at.error.log;
ssl_certificate /etc/letsencrypt/live/devicedetector.lw1.at/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/devicedetector.lw1.at/privkey.pem;
root /var/www/devicedetector/public/;
index index.html;
location / {
try_files $uri $uri/index.html /index.html;
rewrite ^([^.]*[^/])$ $1/ permanent;
rewrite /detect/ /ua.php last;
rewrite /supported/ /supported.php last;
}
location ~ \.php$ {
limit_req zone=ddlimit burst=20 nodelay;
limit_req_status 429;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff|woff2|svg)$ {
expires 12h;
add_header Pragma public;
add_header Cache-Control "public";
}
location ~* \.(html)$ {
add_header Cache-Control "must-revalidate";
}
}
# vim: filetype=nginx