Commit 47b3c387 authored by Pepijn Boers's avatar Pepijn Boers
Browse files

Setup 1.0

parent 6c6be515
......@@ -21,12 +21,14 @@ services:
volumes:
- ./data/data:/var/lib/mysql:Z
- ./data/backup:/var/lib/backup:Z
- ./mysqlconf:/etc/mysql/conf.d:z
- ./mysql/setup-db.sql:/docker-entrypoint-initdb.d/setup-db.sql:z
- ./mysqlconf:/etc/mysql/conf.d:z
environment:
- MYSQL_ROOT_PASSWORD=admin
env_file:
- ./mysql/db.env
cap_add:
- SYS_NICE
restart: on-failure
app:
......@@ -48,12 +50,14 @@ services:
volumes:
- ./data/data_dnt:/var/lib/mysql:Z
- ./data/backup_dnt:/var/lib/backup:Z
- ./mysqlconf:/etc/mysql/conf.d:z
- ./mysql/setup-db.sql:/docker-entrypoint-initdb.d/setup-db.sql:z
- ./mysqlconf:/etc/mysql/conf.d:z
environment:
- MYSQL_ROOT_PASSWORD=admin
env_file:
- ./mysql/db.env
cap_add:
- SYS_NICE
restart: on-failure
app-dnt:
......
# Main context
worker_processes auto;
error_log logs/error.log;
pid logs/nginx.pid;
pid /run/nginx.pid;
events {
# Maximum number of simultaneous connections that can be opened by a worker process.
......@@ -9,7 +8,7 @@ events {
}
http {
# Listen to port 80 and redirect to 443 (SSL)
# Listen to port 80 and redirect to 443 (SSL)
server {
listen 80 default_server;
server_name matomo.science.ru.nl www.matomo.science.ru.nl;
......@@ -29,14 +28,8 @@ http {
# Admin page main Matomo server
location / {
# Set proxy headers to compensate for proxy pipe.
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
proxy_pass http://app;
}
......@@ -47,40 +40,31 @@ http {
# Admin page of second DNT Matomo server
location /dnt/ {
# Set proxy headers to compensate for proxy pipe.
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# We do not want to send requests to app-dnt/dnt but to app-dnt/, so rewrite!
# Don't send requests to app-dnt/dnt but to app-dnt/, so rewrite.
rewrite ^/dnt(.*) /$1 break;
proxy_set_header X-Forwarded-Uri "/dnt";
proxy_pass http://app-dnt;
}
# Javascript snippet requests
# Javascript snippet request
location /matomo.php {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
# mirror request to /mirror
# duplicate request to /mirror
mirror /mirror;
proxy_pass http://app;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://app$request_uri;
}
# Javascript snippet mirror request location
location = /mirror {
internal;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $realip_remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
# $request_uri is "/something" for url "https://example.com/something"
proxy_pass http://app-dnt$request_uri;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment