diff --git a/nginx.conf.example b/nginx.conf.example index 064f1b200..c2f6dc2c6 100644 --- a/nginx.conf.example +++ b/nginx.conf.example @@ -1,9 +1,11 @@ server { listen 80 default_server; listen 443 ssl http2; - server_name _; + ssl_certificate /ssl/crt/file.crt; ssl_certificate_key /ssl/key/file.key; + + server_name site.com; root /home/user/site.com; @@ -21,13 +23,13 @@ server { } # Prevent Direct Access To Protected Folders - location ~ /(app|bootstrap|config|database|resources|routes|storage|tests|artisan) { - return 301 $scheme://$host$uri$is_args$args; + location ~ ^/(app|bootstrap|config|database|resources|routes|storage|tests|artisan) { + deny all; } - + # Prevent Direct Access To modules/vendor Folders Except Assets - location ~ /(modules|vendor)\/(.*)\.((?!ico|gif|jpg|jpeg|png|js|css|less|sass|font|woff|woff2|eot|ttf|svg).)*$ { - return 301 $scheme://$host$uri$is_args$args; + location ~ ^/(modules|vendor)\/(.*)\.((?!ico|gif|jpg|jpeg|png|js|css|less|sass|font|woff|woff2|eot|ttf|svg).)*$ { + deny all; } location ~ \.php$ {