Application templatesΒΆ

Caution

Do NOT include location like the following in a template as it be a duplicate and invalidate config

location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {}

A bare minimum PHP webapp template is

# A nice description of what the template does

root {{ DOCUMENTROOT }};

location / {
try_files $uri $uri/ /index.php;
}

#Required for php ping/pong monitoing to work
location ~ ^/pingphpfpm$ {
include /etc/nginx/fastcgi_params*;
fastcgi_pass unix:{{ SOCKETFILE }};
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:{{ SOCKETFILE }};
fastcgi_index index.php;
include /etc/nginx/fastcgi_params*;
}

Application templates are JinJa2 ,but include minimum template logic and very few variables for easy handling by sysadmin. No knowledge of JinJa2 is required to create a template. Only knowhow required is nginx syntax