ctbk.de/README.md
2024-04-05 20:19:17 +02:00

2.4 KiB

Website des Chaostreff Backnang

nginx config

    # Charset
    charset UTF-8;

    # Enable gzip but do not remove ETag headers
    gzip on;
    gzip_vary on;
    gzip_comp_level 4;
    gzip_min_length 256;
    gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
    gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

    # Remove X-Powered-By, which is an information leak
    fastcgi_hide_header X-Powered-By;

    # Site-Icon Rules
    rewrite ^/favicon\.ico$ img/favicon.ico redirect;

    # Caching
    location ~* \.(?:jpg|gif|png|ico|gz|svg|css|js|pdf|woff|woff2)$ {
        access_log        off;
        log_not_found     off;
        expires           1w;
        add_header Cache-Control "public";
        add_header Cache-Control "max-age=604800";
        gzip_static on;
    }

    index index.html index.htm;

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Spaceapi
    location = /spaceapi.json {
        return 302 /spaceapi/;
    }
    location = /spaceapi {
        return 302 /spaceapi/;
    }
    location /spaceapi/ {
        proxy_pass https://spaceapi.ctbk.de/;
    }

    # Hackcal
    location = /hackcal {
        return 302 /hackcal/;
    }
    location /hackcal/ {
        proxy_pass https://hackcal.ctbk.de/;
    }

Apache/Netcup

Da Netcup keine nginx Configanpassungen und kein Reverse Proxy zulässt, gibt es noch eine .htaccess und die Ordner spaceapi und hackcal mit jeweils einem Proxyscript

Minify resources

for file in `find -name "*.js" -not -name "*.min.js" -not -name "sw.js" -type f` ; do F_NAME=$(dirname ${file})/$(basename ${file} .js); uglifyjs ${file} > ${F_NAME}.min.js; done

for file in `find -name "*.css" -not -name "*.min.css" -type f`; do F_NAME=$(dirname ${file})/$(basename ${file} .css); cleancss ${file} > ${F_NAME}.min.css; done

optipng -o7 -zm1-9 -strip all img/*.png

for file in `find -name "*.min.css" -o -name "*.min.js" -o -name "*.svg" -type f`; do zopfli --i1000 ${file}; done