From 7255de71bc2222f3f2d30ca9ff5fbb9c9c4d13af Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Fri, 13 Sep 2019 19:09:53 +0200 Subject: [PATCH] add nginx config --- nginx.conf | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 nginx.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..15a714f --- /dev/null +++ b/nginx.conf @@ -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