From 0c9e4b41b3a7bffacd934e7b4a0b3052836974f3 Mon Sep 17 00:00:00 2001 From: Simon C Date: Tue, 17 Mar 2020 11:19:40 +0100 Subject: [PATCH] feat: Remove matomo and used goaccess to generate static analytics --- Dockerfile | 7 +++-- docker-compose.yml | 14 ---------- nginx-compression.conf | 8 ------ nginx-default.conf | 55 --------------------------------------- nginx-hide.conf | 1 - package.json | 1 + static/robots.txt | 2 ++ themes/hugo-theme-lowtech | 2 +- 8 files changed, 7 insertions(+), 83 deletions(-) delete mode 100644 nginx-compression.conf delete mode 100644 nginx-default.conf delete mode 100644 nginx-hide.conf create mode 100644 static/robots.txt diff --git a/Dockerfile b/Dockerfile index cc6e9e0..8dc0aab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ -FROM nginx -COPY nginx-default.conf /etc/nginx/conf.d/default.conf -COPY nginx-compression.conf /etc/nginx/conf.d/compression.conf -COPY nginx-hide.conf /etc/nginx/conf.d/hide.conf +FROM kosssi/nginx-lowtech:0.0.2 + +# Copie des sources du site COPY public /usr/share/nginx/html diff --git a/docker-compose.yml b/docker-compose.yml index df20610..34f2781 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,20 +35,6 @@ services: traefik.http.routers.histoiredunpied-redirect-www-https.tls.certResolver: "letsencrypt" traefik.http.routers.histoiredunpied-redirect-www-https.middlewares: "redirect-www@docker" - matomo: - container_name: ${NAME}_matomo - image: kosssi/matomo-log-analytics - depends_on: - - histoiredunpied - environment: - MATOMO_URL: ${MATOMO_URL} - MATOMO_IDSITE: ${MATOMO_IDSITE} - MATOMO_TOKEN_AUTH: ${MATOMO_TOKEN_AUTH} - LOG_PATH: ${LOG_PATH} - CRON_FREQUENCY: ${CRON_FREQUENCY} - volumes: - - histoiredunpied-log-volume:/var/log/nginx - networks: default: external: diff --git a/nginx-compression.conf b/nginx-compression.conf deleted file mode 100644 index e0f535d..0000000 --- a/nginx-compression.conf +++ /dev/null @@ -1,8 +0,0 @@ -#Compression -gzip on; -gzip_disable "msie6"; -gzip_vary on; -gzip_comp_level 6; -gzip_buffers 16 8k; -gzip_http_version 1.1; -gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon; diff --git a/nginx-default.conf b/nginx-default.conf deleted file mode 100644 index 77c6d64..0000000 --- a/nginx-default.conf +++ /dev/null @@ -1,55 +0,0 @@ -# Expires map -map $sent_http_content_type $expires { - default off; - text/html 7d; - text/css max; - application/javascript max; - ~image/ max; -} - -server { - listen 80; - server_name localhost; - - #charset koi8-r; - #access_log /var/log/nginx/host.access.log main; - - location / { - root /usr/share/nginx/html; - index index.html index.htm; - } - - # https://gtmetrix.com/specify-a-character-set-early.html - # https://www.cyberciti.biz/faq/nginx-set-http-content-type-response-header-to-charset-utf8/ - charset UTF-8; - - add_header X-UA-Compatible "IE=Edge,chrome=1"; - - # https://www.justegeek.fr/proteger-un-peu-plus-son-site-avec-la-balise-x-content-type-options/ - add_header X-Content-Type-Options "nosniff"; - - add_header X-XSS-Protection "1; mode=block"; - add_header X-Frame-Options DENY; - add_header Referrer-Policy "strict-origin-when-cross-origin"; - - # https://scotthelme.co.uk/content-security-policy-an-introduction/ - add_header Content-Security-Policy "script-src 'self'"; - - # https://scotthelme.co.uk/a-new-security-header-feature-policy/ - #add_header Feature-Policy "vibrate none"; - - # https://scotthelme.co.uk/hsts-the-missing-link-in-tls/ - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; - - #Caching (save html pages for 7 days, rest as long as possible, no caching on frontpage) - expires $expires; - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } -} diff --git a/nginx-hide.conf b/nginx-hide.conf deleted file mode 100644 index b3a5f35..0000000 --- a/nginx-hide.conf +++ /dev/null @@ -1 +0,0 @@ -server_tokens off; diff --git a/package.json b/package.json index 325af25..2155e35 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "favicon": "convert static/icon.png -resize 32x32 -colors 16 \\( -clone 0 -resize 16x16 -extent 16x16 \\) \\( -clone 0 -resize 32x32 -extent 32x32 \\) -delete 0 static/favicon.ico", "svgo": "svgo */**.svg", "deploy": "docker-compose up -d --build", + "stats": "./themes/hugo-theme-lowtech/scripts/stats.sh", "ftp-deploy": "lftp -u $HISTOIREDUNPIED_FTP_USER,$HISTOIREDUNPIED_FTP_PASSWORD $HISTOIREDUNPIED_FTP_HOST -e 'mirror -e -R ./public /www ; quit'", "ftp-htaccess": "lftp -u $HISTOIREDUNPIED_FTP_USER,$HISTOIREDUNPIED_FTP_PASSWORD $HISTOIREDUNPIED_FTP_HOST -e 'put ./.htaccess ; quit'", "test": "echo \"Error: no test specified\" && exit 1" diff --git a/static/robots.txt b/static/robots.txt new file mode 100644 index 0000000..fe0c023 --- /dev/null +++ b/static/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /stats.html diff --git a/themes/hugo-theme-lowtech b/themes/hugo-theme-lowtech index 8da32f8..5c3965e 160000 --- a/themes/hugo-theme-lowtech +++ b/themes/hugo-theme-lowtech @@ -1 +1 @@ -Subproject commit 8da32f8afd91ef803551fdf592f2d3efc70773c6 +Subproject commit 5c3965e4c27002e7390b27d8eb784536bc7cac52