Configs/Server/Root/etc/nginx/sites-available/SpaccBBS.conf

103 lines
2.9 KiB
Plaintext

map $http_host $SpaccBbsMap {
'bbs.spacc.eu.org' '1';
'bbs.spaccsoj3trhzowrrblzb5m6hgkwu6syghnmhett7gvxbrz5zhsrs4ad.onion' '2';
}
server {
listen 80;
listen 443 ssl;
server_name bbs.spacc.eu.org bbs.spaccsoj3trhzowrrblzb5m6hgkwu6syghnmhett7gvxbrz5zhsrs4ad.onion;
ssl_certificate /etc/letsencrypt/live/bbs.spacc.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/bbs.spacc.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
root /Server/www/SpaccBBS;
index index.php index.html index.htm;
# Loggers
error_log /var/log/nginx/SpaccBBS.error.log warn;
access_log /var/log/nginx/SpaccBBS.access.log;
location / {
try_files $uri $uri/ @rewriteapp;
# Pass the php scripts to FastCGI server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /app.php$is_args$args;
fastcgi_pass php;
}
# Deny access to internal phpbb files.
location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|install.bak|(?<!ext/)phpbb(?!\w+)|store|vendor) {
deny all;
# deny was ignored before 0.8.40 for connections over IPv6.
# Use internal directive to prohibit access on older versions.
internal;
}
location /includes {
deny all;
internal;
}
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# Correctly pass scripts for installer
location /install/ {
try_files $uri $uri/ @rewrite_installapp =404;
# Pass the php scripts to fastcgi server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /install/app.php$is_args$args =404;
fastcgi_pass php;
}
}
location @rewrite_installapp {
rewrite ^(.*)$ /install/app.php/$1 last;
}
# Deny access to version control system directories.
location ~ /\.svn|/\.git {
deny all;
internal;
}
location /wap {
rewrite ^ $scheme://$host/?style=4 redirect;
}
location /lite {
rewrite ^ $scheme://$host/wap redirect;
}
#if ($SpaccBbsMap = '1') {
# location /wwwroot {
# rewrite ^(.*) $scheme://hlb0.octt.eu.org/$request_uri redirect;
# }
#}
#if ($SpaccBbsMap = '2') {
# location /wwwroot {
# rewrite ^(.*) $scheme://octt.spaccsoj3trhzowrrblzb5m6hgkwu6syghnmhett7gvxbrz5zhsrs4ad.onion/$request_uri redirect;
# }
#}
location /wwwroot {
if ($SpaccBbsMap = '1') {
rewrite ^(.*) $scheme://hlb0.octt.eu.org/$request_uri redirect;
}
if ($SpaccBbsMap = '2') {
rewrite ^(.*) $scheme://octt.spaccsoj3trhzowrrblzb5m6hgkwu6syghnmhett7gvxbrz5zhsrs4ad.onion/$request_uri redirect;
}
}
}