102 lines
3.0 KiB
Nginx Configuration File
102 lines
3.0 KiB
Nginx Configuration File
# Example for conf.d/default.conf
|
|
user www-data;
|
|
worker_processes 1;
|
|
|
|
error_log /var/log/nginx/error.log;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
|
|
upstream notenextra-math {
|
|
server notenextra-math:4200;
|
|
}
|
|
|
|
upstream notenextra-cse {
|
|
server notenextra-cse:4200;
|
|
}
|
|
|
|
# Decide where to send /_pagefind* based on the page that made the request
|
|
map $http_referer $load_upstream {
|
|
default http://notenextra-cse;
|
|
~*://[^/]+/Math(?:/|$) http://notenextra-math;
|
|
~*://[^/]+/CSE(?:/|$) http://notenextra-cse;
|
|
}
|
|
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
# add extra types
|
|
|
|
types {
|
|
text/javascript mjs;
|
|
}
|
|
|
|
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;
|
|
|
|
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
rewrite ^/.well-known/carddav /remote.php/dav/ permanent;
|
|
rewrite ^/.well-known/caldav /remote.php/dav/ permanent;
|
|
|
|
location = /robots.txt {
|
|
allow all;
|
|
log_not_found off;
|
|
access_log off;
|
|
}
|
|
|
|
# Send all next or additional assets (/_pagefind.js and /_pagefind/*) to the chosen app
|
|
# ^~ /_pagefind matches both "/_pagefind.js" and "/_pagefind/..."
|
|
location ^~ /_(.*)$ {
|
|
proxy_pass $load_upstream; # leaves URI intact (/_pagefind.js, /_pagefind/manifest.json, etc.)
|
|
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;
|
|
}
|
|
|
|
location ~ ^/(build|tests|config|lib|3rdparty|templates|data)/ {
|
|
deny all;
|
|
}
|
|
|
|
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
|
|
deny all;
|
|
}
|
|
|
|
location ~ ^/Math(.*)$ {
|
|
proxy_pass http://notenextra-math/Math$1;
|
|
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;
|
|
}
|
|
|
|
location ~ ^/CSE(.*)$ {
|
|
proxy_pass http://notenextra-cse/CSE$1;
|
|
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;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://notenextra-math;
|
|
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;
|
|
}
|
|
|
|
}
|
|
} |