Stream editing working tracking not
This commit is contained in:
parent
9fc16fda7e
commit
53783f238e
|
@ -4,7 +4,7 @@ FROM nginx:alpine
|
|||
# Copy our custom Nginx configuration and script
|
||||
COPY nginx.conf /etc/nginx/nginx.conf.template
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
COPY matomo.js /matomo.js.template
|
||||
# Make the script executable
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: codeberg.org/iridium-net/lan-to-nginx:latest
|
||||
image: codeberg.org/iridium-net/lan-to-nginx:truenas
|
||||
environment:
|
||||
- BACKEND_ADDRESS=192.168.8.1 # Replace with your backend address
|
||||
- BACKEND_PORT=80 # Replace with your backend port
|
||||
|
|
|
@ -3,10 +3,16 @@
|
|||
PROTOCOL="${PROTOCOL:-http}"
|
||||
|
||||
# Replace placeholders with environment variable values
|
||||
envsubst '$BACKEND_ADDRESS $BACKEND_PORT $PROTOCOL' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
|
||||
|
||||
# Use envsubst to replace environment variables in nginx.conf.template and output to nginx.conf
|
||||
#envsubst '$BACKEND_ADDRESS,$BACKEND_PORT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
|
||||
envsubst '$BACKEND_ADDRESS $BACKEND_PORT $PROTOCOL $MATOMO_URL $MATOMO_SITE_ID' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
|
||||
# Substitute environment variables in matomo.js
|
||||
envsubst '$MATOMO_URL $MATOMO_SITE_ID' < /matomo.js.template > /matomo.js
|
||||
|
||||
# Start nginx in the foreground
|
||||
curl -k -I $PROTOCOL://$BACKEND_ADDRESS:$BACKEND_PORT
|
||||
echo checking nginx modules
|
||||
nginx -V 2>&1 | grep -o http_sub_module
|
||||
echo /matomo.js
|
||||
cat /matomo.js
|
||||
echo /etc/nginx/nginx.conf
|
||||
cat /etc/nginx/nginx.conf
|
||||
exec nginx -g 'daemon off;'
|
||||
|
|
31
nginx.conf
31
nginx.conf
|
@ -6,22 +6,43 @@ events {
|
|||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
# Define MIME type
|
||||
types {
|
||||
text/html html htm shtml;
|
||||
}
|
||||
|
||||
location / {
|
||||
# Use the placeholders for the proxy pass (these will be replaced by envsubst)
|
||||
proxy_pass ${PROTOCOL}://$BACKEND_ADDRESS:$BACKEND_PORT;
|
||||
# proxy_pass http://$BACKEND_ADDRESS:$BACKEND_PORT;
|
||||
# Use the placeholders for the proxy pass
|
||||
proxy_pass ${PROTOCOL}://${BACKEND_ADDRESS}:${BACKEND_PORT};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
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 Accept-Encoding "";
|
||||
proxy_buffering off;
|
||||
proxy_ssl_verify off; # Skip SSL verification, be cautious
|
||||
|
||||
# Enable response body filtering
|
||||
sub_filter_once off;
|
||||
|
||||
# Inject the Matomo content just before </head>
|
||||
# sub_filter '</head>' '<script src="/matomo.js"></script></head>';
|
||||
sub_filter '</head>' '<!-- Matomo --><script>var _paq = window._paq = window._paq || [];_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);_paq.push(["setCookieDomain", "*.nixc.us"]);_paq.push(["setDomains", ["*.nixc.us"]]);_paq.push(["setDoNotTrack", true]);_paq.push(["disableCookies"]);_paq.push(["trackPageView"]);_paq.push(["enableLinkTracking"]);(function() {var u="//m.nixc.us/";_paq.push(["setTrackerUrl", u+"matomo.php"]);_paq.push(["setSiteId", "1"]);var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0];g.async=true; g.src=u+"matomo.js"; s.parentNode.insertBefore(g,s);})();</script><noscript><p><img src="//m.nixc.us/matomo.php?idsite=1&rec=1" style="border:0;" alt="" /></p></noscript><!-- End Matomo Code --></head>';
|
||||
sub_filter_types application/xml application/json text/css text/javascript application/javascript text/plain;
|
||||
|
||||
}
|
||||
|
||||
# location /matomo.js {
|
||||
# alias /matomo.js;
|
||||
# types { application/javascript js; } # Explicitly set the MIME type for .js files
|
||||
# default_type application/javascript; # Setting default MIME type for this location block
|
||||
# }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
version: "3.9"
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
||||
|
||||
services:
|
||||
truenas:
|
||||
image: codeberg.org/iridium-net/lan-to-nginx:truenas
|
||||
environment:
|
||||
- BACKEND_ADDRESS=192.168.8.47
|
||||
- BACKEND_PORT=443
|
||||
- PROTOCOL=https
|
||||
- MATOMO_URL=//m.nixc.us/ # Replace with your actual Matomo URL if different.
|
||||
- MATOMO_SITE_ID=1 # Replace with your actual Site ID if different.
|
||||
networks:
|
||||
- traefik
|
||||
deploy:
|
||||
replicas: 1
|
||||
placement:
|
||||
constraints:
|
||||
- node.hostname == macmini7
|
||||
labels:
|
||||
- "us.nixc.autodeploy=true"
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.truenas-proxy.tls=true"
|
||||
- "traefik.http.services.truenas-proxy.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.truenas-proxy.rule=Host(`truenas.nixc.us`)"
|
||||
- "traefik.http.routers.truenas-proxy.entrypoints=websecure"
|
||||
- "traefik.http.routers.truenas-proxy.tls.certresolver=letsencryptresolver"
|
||||
- "traefik.http.routers.truenas-proxy.service=truenas-proxy"
|
||||
- "traefik.docker.network=traefik"
|
||||
# - 'traefik.http.routers.truenas-proxy.middlewares=authelia_authelia@docker'
|
30
unifi.yml
30
unifi.yml
|
@ -1,30 +0,0 @@
|
|||
version: "3.9"
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
||||
|
||||
services:
|
||||
unifi:
|
||||
image: codeberg.org/iridium-net/lan-to-nginx:latest
|
||||
environment:
|
||||
- BACKEND_ADDRESS=192.168.8.1
|
||||
- BACKEND_PORT=443
|
||||
- PROTOCOL=https
|
||||
networks:
|
||||
- traefik
|
||||
deploy:
|
||||
replicas: 1
|
||||
placement:
|
||||
constraints:
|
||||
- node.hostname == macmini7
|
||||
labels:
|
||||
- "us.nixc.autodeploy=true"
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.nginx-proxy.tls=true"
|
||||
- "traefik.http.services.nginx-proxy.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.nginx-proxy.rule=Host(`unifi.nixc.us`)"
|
||||
- "traefik.http.routers.nginx-proxy.entrypoints=websecure"
|
||||
- "traefik.http.routers.nginx-proxy.tls.certresolver=letsencryptresolver"
|
||||
- "traefik.http.routers.nginx-proxy.service=nginx-proxy"
|
||||
- "traefik.docker.network=traefik"
|
Loading…
Reference in New Issue