Skip to content

Commit

Permalink
Add laravel preset template
Browse files Browse the repository at this point in the history
  • Loading branch information
csandanov committed Sep 14, 2024
1 parent f7a8a65 commit 3265a19
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ process_templates() {
if [[ -n "${NGINX_VHOST_PRESET}" ]]; then
_gotpl "presets/${NGINX_VHOST_PRESET}.conf.tmpl" "/etc/nginx/preset.conf"

if [[ "${NGINX_VHOST_PRESET}" = drupal* || "${NGINX_VHOST_PRESET}" =~ ^wordpress|matomo|php$ ]]; then
if [[ "${NGINX_VHOST_PRESET}" = drupal* || "${NGINX_VHOST_PRESET}" =~ ^wordpress|matomo|php|laravel$ ]]; then
_gotpl "includes/upstream.php.conf.tmpl" "/etc/nginx/upstream.conf"
elif [[ "${NGINX_VHOST_PRESET}" =~ ^http-proxy|django$ ]]; then
if [[ -z "${NGINX_BACKEND_HOST}" && "${NGINX_VHOST_PRESET}" == "django" ]]; then
Expand Down
34 changes: 34 additions & 0 deletions templates/presets/laravel.conf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{ $static := (getenv "NGINX_STATIC_EXT_REGEX" "css|cur|js|jpe?g|gif|htc|ico|png|xml|otf|ttf|eot|woff|woff2|svg|mp4|svgz|ogg|ogv|pdf|pptx?|zip|tgz|gz|rar|bz2|doc|xls|exe|tar|mid|midi|wav|bmp|rtf|txt|map|webp") }}

include fastcgi.conf;

{{ $index := (getenv "NGINX_FASTCGI_INDEX" "index.php") }}
index {{ getenv "NGINX_INDEX_FILE" "index.php index.html" }};

location / {
location ~* ^.+\.(?:{{ $static }})$ {
access_log {{ getenv "NGINX_STATIC_ACCESS_LOG" "off" }};
tcp_nodelay {{ getenv "NGINX_STATIC_TCP_NODELAY" "off" }};
expires {{ getenv "NGINX_STATIC_EXPIRES" "1y" }};

add_header Pragma "cache";
add_header Cache-Control "public";

open_file_cache {{ getenv "NGINX_STATIC_OPEN_FILE_CACHE" "max=1000 inactive=30s" }};
open_file_cache_valid {{ getenv "NGINX_STATIC_OPEN_FILE_CACHE_VALID" "30s" }};
open_file_cache_min_uses {{ getenv "NGINX_STATIC_OPEN_FILE_CACHE_MIN_USES" "2" }};
open_file_cache_errors {{ getenv "NGINX_STATIC_OPEN_FILE_CACHE_ERRORS" "off" }};

{{- if getenv "NGINX_STATIC_404_TRY_INDEX" }}
try_files $uri /{{ $index }}?$args;
{{- end }}
}

try_files $uri /{{ $index }}?$args;
}

location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass php;
track_uploads {{ getenv "NGINX_TRACK_UPLOADS" "uploads 60s" }};
}

0 comments on commit 3265a19

Please sign in to comment.