akaunting/nginx.example.com.conf

54 lines
1.4 KiB
Plaintext
Raw Normal View History

2019-03-07 10:35:08 +03:00
server {
listen 80 default_server;
listen 443 ssl http2;
2020-02-20 09:42:03 +03:00
2019-03-07 10:35:08 +03:00
ssl_certificate /ssl/crt/file.crt;
ssl_certificate_key /ssl/key/file.key;
2020-02-20 09:42:03 +03:00
2019-03-07 10:35:08 +03:00
server_name example.com;
root /var/www/example.com/public_html;
2020-02-20 09:42:03 +03:00
2019-03-07 14:38:50 +03:00
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
2019-03-07 10:35:08 +03:00
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Prevent Direct Access To Protected Files
2020-02-20 13:31:10 +03:00
location ~ \.(env|log) {
2019-03-07 10:35:08 +03:00
deny all;
}
# Prevent Direct Access To Protected Folders
2020-02-20 09:42:03 +03:00
location ~ ^/(^app$|bootstrap|config|database|overrides|resources|routes|storage|tests|artisan) {
2019-03-07 10:35:08 +03:00
deny all;
}
2020-02-20 09:42:03 +03:00
2019-03-07 10:35:08 +03:00
# Prevent Direct Access To modules/vendor Folders Except Assets
location ~ ^/(modules|vendor)\/(.*)\.((?!ico|gif|jpg|jpeg|png|js\b|css|less|sass|font|woff|woff2|eot|ttf|svg|xls|xlsx).)*$ {
2019-03-07 10:35:08 +03:00
deny all;
}
2020-02-20 09:42:03 +03:00
2019-03-07 14:38:50 +03:00
error_page 404 /index.php;
2019-03-07 10:35:08 +03:00
# Pass PHP Scripts To FastCGI Server
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; # Depends On The PHP Version
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
2019-03-07 14:38:50 +03:00
include fastcgi_params;
}
2019-03-07 10:35:08 +03:00
2019-03-07 14:38:50 +03:00
location ~ /\.(?!well-known).* {
deny all;
2019-03-07 10:35:08 +03:00
}
2020-02-20 09:42:03 +03:00
}