1
0
Fork 0

Update nginx.conf

This commit is contained in:
colin 2023-11-21 17:13:54 +00:00
parent 53783f238e
commit 860e1456e3
1 changed files with 17 additions and 17 deletions

View File

@ -17,32 +17,32 @@ http {
} }
location / { location / {
# Use the placeholders for the proxy pass # Use the placeholders for the proxy pass (ensure these are properly substituted)
proxy_pass ${PROTOCOL}://${BACKEND_ADDRESS}:${BACKEND_PORT}; proxy_pass http://backend:port; # Replace with actual backend address and port
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade"; proxy_set_header Connection $connection_upgrade; # This can handle both Upgrade and close
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding ""; proxy_set_header Accept-Encoding "";
proxy_buffering off; 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&amp;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;
# Error handling (example)
error_page 502 /502.html;
location = /502.html {
root /usr/share/nginx/html;
internal;
}
} }
# location /matomo.js { # Custom location for WebSocket if needed
# alias /matomo.js; # location /ws {
# types { application/javascript js; } # Explicitly set the MIME type for .js files # proxy_pass http://backend:port;
# default_type application/javascript; # Setting default MIME type for this location block # proxy_http_version 1.1;
# } # proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "Upgrade";
# # Other necessary headers...
# }
} }
} }