This commit is contained in:
Mark Janssen 2024-07-18 20:55:48 +02:00
parent c783601fa9
commit 792f2749b6
21 changed files with 160 additions and 58 deletions

2
snippets/bitair-nginx.j2 Normal file
View file

@ -0,0 +1,2 @@
root /opt/bitair.nl/;
index index.html;

View file

@ -1,18 +0,0 @@
---
- name: Install nginx
apt:
name: nginx
state: present
- name: Disable nginx server_tokens
lineinfile:
path: /etc/nginx/nginx.conf
line: "\tserver_tokens off;"
regexp: "server_tokens"
notify: reload nginx
- name: Clear default nginx site
file:
state: absent
path: /etc/nginx/sites-enabled/default
notify: reload nginx

View file

@ -0,0 +1,11 @@
# mqtt2web nginx config snippet
location /mqtt/ {
proxy_pass http://localhost:8080/mqtt;
include proxy_params;
proxy_buffering off;
proxy_cache off;
proxy_http_version 1.1;
proxy_set_header Connection '';
chunked_transfer_encoding off;
}

View file

@ -0,0 +1,2 @@
root /opt/ravespace.nl/;
index index.html;

View file

@ -0,0 +1,8 @@
# spaceapi nginx config snippet
location = /statejson {
proxy_pass http://localhost:8888;
include proxy_params;
add_header 'Access-Control-Allow-Origin' '*';
}

89
snippets/www-nginx.j2 Normal file
View file

@ -0,0 +1,89 @@
root /opt/mediawiki-1.41.1/;
# Photo gallery
location = /fotos {
return 302 $scheme://bitlair.nl/fotos/;
}
location ~* ^/fotos/(.*)$ {
proxy_pass http://204.2.68.2:4567/$1$is_args$args;
}
location ~ ^/state/(.+)$ {
alias /opt/spaceapi/assets/$1;
}
location = /events.ics {
alias /var/lib/bitlair-calendar/events.ics;
}
location ~ ^/(cache|maintenance|vendor|extensions)/ {
deny all;
}
# Legacy space API stuff.
location ~ ^/(putconfig|putjson|putstate|state|statejson)\.php$ {
root "/opt/legacy/";
fastcgi_pass unix:/run/php/php-fpm.sock;
include fastcgi.conf;
}
location ~ ^/(bitlair.svg|bitlair_closed.png|bitlair_open.png|state|statejson)$ {
root "/opt/legacy/";
}
location ~ ^/wp-content {
root "/opt/legacy/";
}
location = /statejson.php {
rewrite ^.+$ /statejson;
}
# Mediawiki
location / {
try_files $uri $uri/ @rewrite;
}
location ~ \.php$ {
try_files $uri @rewrite;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location @rewrite {
# rewrite ^/(.*)$ /index.php;
rewrite ^/(.*)$ /index.php?title=$1$args;
}
location ~ \.(png|css|ico|pdf|flv|jpe?g|gif|js|css)$ {
try_files $uri @rewrite;
expires 1M;
}
location = /_.gif {
expires max;
empty_gif;
}
#location /dumps {
# root /opt/bitlair-wiki/local;
# autoindex on;
#}
# Legacy: redirect old prefix.
location /Pages/ {
rewrite ^/Pages/(.*) https://$server_name/$1$args redirect;
}
# Matrix realm delegation
location = /.well-known/matrix/server {
add_header "Content-Type" "application/json";
add_header "Access-Control-Allow-Origin" "*";
alias /opt/matrix-delegation.json;
}
location = /.well-known/security.txt {
alias /opt/security.txt;
}