Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Potthast danielpotthast

View GitHub Profile
@danielpotthast
danielpotthast / cache.conf
Created May 26, 2018
NGINX – Snippet: Caching
View cache.conf
# Fonts
if ( $uri ~* ^.+?\.(?:eot|svg|svgz|ttf|woff|woff2)$ ) {
expires 30d;
access_log off;
add_header Cache-Control "public";
add_header Access-Control-Allow-Origin *;
}
# Feed
if ( $uri ~* ^.+?\.(?:rss|atom)$ ) {
@danielpotthast
danielpotthast / fastcgi.conf
Created May 26, 2018
NGINX – Snippet: FastCGI
View fastcgi.conf
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
@danielpotthast
danielpotthast / proxy.conf
Created May 26, 2018
NGINX – Snippet: Proxy
View proxy.conf
proxy_redirect off;
client_max_body_size 64M;
client_body_buffer_size 128k;
proxy_read_timeout 10s;
proxy_connect_timeout 10s;
proxy_send_timeout 10s;
proxy_headers_hash_bucket_size 256;
proxy_headers_hash_max_size 2048;
proxy_buffering off;
proxy_buffer_size 128k;
@danielpotthast
danielpotthast / 10-http.conf
Last active May 26, 2018
NGINX – HTTP-Konfiguration
View 10-http.conf
server {
listen 80;
listen [::]:80;
server_name sitename.tld;
location ^~ /.well-known/acme-challenge/ {
alias /var/www/letsencrypt/.well-known/acme-challenge/;
}
location / {
@danielpotthast
danielpotthast / 20-https.conf
Last active May 19, 2019
NGINX – HTTPS-Konfiguration
View 20-https.conf
# Varnish Upstream with NGINX Fallback
upstream wordpress-varnish {
server 127.0.0.1:6081 weight=5 max_fails=1 fail_timeout=5s;
server 127.0.0.1:8080 backup;
}
# HTTPS Server
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
@danielpotthast
danielpotthast / default.vcl
Created May 26, 2018
Varnish Konfiguration
View default.vcl
vcl 4.0;
# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
}
View sblum-google-tag-manager--embed.html
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-ID1234');</script>
View sblum-google-tag-manager--data-layer.html
<!-- Data Layer -->
<script>
dataLayer = [{
'locale': 'de',
'site': 'sblum.de',
'siteName': 'Google Tag Manager',
'pageSection': ['tutorials','guides'],
'article': {
'author': 'sblum Team',
'category': 'GTM',
View sblum-google-tag-manager--data-layer-facebook.html
<a href="https://www.facebook.com/sebastian.blum"
onmousedown="dataLayer.push({
'event': 'click.social',
'socialSite': 'Facebook',
'socialType': 'Privates Profil'
});">
</a>
View sblum-google-tag-manager--toast.js
toast(
"[css]'css/application.css'",
function () {
// Aufruf, falls CSS ready
},
"[js]'js/application.js'"
);