104 lines
6.9 KiB
Nginx Configuration File
104 lines
6.9 KiB
Nginx Configuration File
user nginx;
|
|
worker_processes auto;
|
|
error_log /var/log/nginx/error.log warn;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
access_log /var/log/nginx/access.log main;
|
|
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
types_hash_max_size 2048;
|
|
client_max_body_size 100M;
|
|
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_types text/plain text/css text/xml text/javascript
|
|
application/javascript application/json
|
|
application/xml+rss image/svg+xml;
|
|
|
|
upstream outline {
|
|
server outline:3000;
|
|
}
|
|
|
|
server {
|
|
listen 3200 default_server;
|
|
listen [::]:3200 default_server;
|
|
server_name wiki.ghostguild.org;
|
|
|
|
# Block access to hidden files (especially .git)
|
|
location ~ /\. {
|
|
deny all;
|
|
return 404;
|
|
}
|
|
|
|
# Health check
|
|
location = /api/health {
|
|
proxy_pass http://outline;
|
|
access_log off;
|
|
}
|
|
|
|
# Homepage: inject OG meta tags + license footer script
|
|
location = / {
|
|
proxy_pass http://outline;
|
|
|
|
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 https;
|
|
proxy_set_header Accept-Encoding "";
|
|
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
# OG tags after <head> so they appear before Outline's own tags
|
|
sub_filter '<head>' '<head><meta property="og:title" content="Ghost Guild Wiki" /><meta property="og:description" content="A living knowledge base for Baby Ghosts & Ghost Guild." /><meta property="og:type" content="website" /><meta property="og:url" content="https://wiki.ghostguild.org" /><meta name="twitter:card" content="summary" /><meta name="twitter:title" content="Ghost Guild Wiki" /><meta name="twitter:description" content="A living knowledge base for Baby Ghosts & Ghost Guild." />';
|
|
|
|
# CC BY-SA 4.0 license footer (script self-gates to /doc/ pages).
|
|
sub_filter '</head>' '<style>.cc-license-footer{margin:4rem 0 2rem;padding:1.5rem 0 0;border-top:1px solid rgba(128,128,128,0.25);font-size:0.85em;line-height:1.5;opacity:0.75}.cc-license-footer p{margin:0}.cc-license-footer a{color:inherit;text-decoration:underline}</style><script>(function(){var URL_HREF="https://creativecommons.org/licenses/by-sa/4.0/";var PREFIX="Content on this site by Baby Ghosts Studio Development Fund is licensed under CC BY-SA 4.0. To view a copy of this license, visit ";function isDoc(){return location.pathname.indexOf("/doc/")===0}function findTarget(){var pm=document.querySelector(".ProseMirror");if(pm&&pm.parentElement)return pm.parentElement;return document.querySelector("article")||document.querySelector("[role=main]")||document.querySelector("main")}function render(){var ex=document.querySelector(".cc-license-footer");if(!isDoc()){if(ex)ex.remove();return}if(ex)return;var t=findTarget();if(!t)return;var f=document.createElement("footer");f.className="cc-license-footer";var p=document.createElement("p");p.appendChild(document.createTextNode(PREFIX));var a=document.createElement("a");a.href=URL_HREF;a.target="_blank";a.rel="noopener noreferrer";a.textContent=URL_HREF;p.appendChild(a);f.appendChild(p);t.appendChild(f)}var pending=false;function s(){if(pending)return;pending=true;requestAnimationFrame(function(){pending=false;render()})}["pushState","replaceState"].forEach(function(m){var o=history[m];history[m]=function(){o.apply(this,arguments);s()}});window.addEventListener("popstate",s);function go(){new MutationObserver(s).observe(document.body,{childList:true,subtree:true});s()}if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",go)}else{go()}})();</script></head>';
|
|
|
|
sub_filter_once on;
|
|
sub_filter_types text/html;
|
|
}
|
|
|
|
# Reverse proxy to Outline with license footer injection
|
|
location / {
|
|
proxy_pass http://outline;
|
|
|
|
# Standard proxy headers
|
|
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 https;
|
|
|
|
# Disable encoding so sub_filter can process the response
|
|
proxy_set_header Accept-Encoding "";
|
|
|
|
# WebSocket support (required for real-time collaboration)
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
# CC BY-SA 4.0 license footer (script self-gates to /doc/ pages).
|
|
sub_filter '</head>' '<style>.cc-license-footer{margin:4rem 0 2rem;padding:1.5rem 0 0;border-top:1px solid rgba(128,128,128,0.25);font-size:0.85em;line-height:1.5;opacity:0.75}.cc-license-footer p{margin:0}.cc-license-footer a{color:inherit;text-decoration:underline}</style><script>(function(){var URL_HREF="https://creativecommons.org/licenses/by-sa/4.0/";var PREFIX="Content on this site by Baby Ghosts Studio Development Fund is licensed under CC BY-SA 4.0. To view a copy of this license, visit ";function isDoc(){return location.pathname.indexOf("/doc/")===0}function findTarget(){var pm=document.querySelector(".ProseMirror");if(pm&&pm.parentElement)return pm.parentElement;return document.querySelector("article")||document.querySelector("[role=main]")||document.querySelector("main")}function render(){var ex=document.querySelector(".cc-license-footer");if(!isDoc()){if(ex)ex.remove();return}if(ex)return;var t=findTarget();if(!t)return;var f=document.createElement("footer");f.className="cc-license-footer";var p=document.createElement("p");p.appendChild(document.createTextNode(PREFIX));var a=document.createElement("a");a.href=URL_HREF;a.target="_blank";a.rel="noopener noreferrer";a.textContent=URL_HREF;p.appendChild(a);f.appendChild(p);t.appendChild(f)}var pending=false;function s(){if(pending)return;pending=true;requestAnimationFrame(function(){pending=false;render()})}["pushState","replaceState"].forEach(function(m){var o=history[m];history[m]=function(){o.apply(this,arguments);s()}});window.addEventListener("popstate",s);function go(){new MutationObserver(s).observe(document.body,{childList:true,subtree:true});s()}if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",go)}else{go()}})();</script></head>';
|
|
|
|
sub_filter_once on;
|
|
sub_filter_types text/html;
|
|
}
|
|
}
|
|
}
|