nginx-configs/common/website.conf

53 lines
1.3 KiB
Plaintext

add_header Onion-Location http://vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion$request_uri;
root /var/www/website;
index index.html;
ssi on;
location / {
rewrite ^(/.*)\.html(\?.*)?$ $1$2 permanent;
rewrite ^/(.*)/$ /$1 permanent;
try_files $uri $uri/index.html $uri.html $uri/ @extensionless-php;
error_page 403 /errors/403;
error_page 404 /errors/404;
error_page 503 /errors/503;
}
location /errors/.* {
internal;
}
location ~ \.php$ {
try_files $uri =404;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
location /.well-known/matrix/server {
default_type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '{"m.server": "mtrx.vern.cc:443"}';
}
location /.well-known/matrix/client {
default_type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '{"m.homeserver": {"base_url": "https://mtrx.vern.cc"}, "m.identity_server": { "base_url": "https://vector.im" }}';
}
location /media/ {
autoindex on;
}
## users
location ~ ^/(~|u/)(?<user>[\w-]+)(?<user_uri>/.*)?$ {
return 301 $scheme://$user.vern.cc;
}