### ENVS.NET - local ### server { listen 89.163.145.170:80 default_server; listen [2001:4ba0:ffa4:180::2]:80 default_server; include snippets/listen_local.conf; # include snippets/listen.conf; # include snippets/ddos_def.conf; server_name envs.net www.envs.net 89.163.145.170 192.168.1.1 127.0.0.1 localhost _; error_log /var/log/nginx/envs.net-error.log crit; location / { return 307 https://$host$request_uri; } location /.well-known/acme-challenge/ { alias /var/lib/letsencrypt/.well-known/acme-challenge/; } location /nginx_status { stub_status on; allow 127.0.0.1; deny all; } } server { listen 89.163.145.170:443 ssl http2 default_server; listen [2001:4ba0:ffa4:180::2]:443 ssl http2 default_server; include snippets/listen_local_ssl.conf; # include snippets/ddos_def.conf; server_name envs.net www.envs.net 89.163.145.170 127.0.0.1 localhost _; include snippets/ssl.conf; include ssl/envs_net_wild.conf; include snippets/local_ssl_header.conf; error_log /var/log/nginx/envs.net-error.log crit; include snippets/error_pages; root /var/www/envs.net/; index index.php index.html; #rewrite ^([^.]*[^/])$ $1/ permanent; location / { add_header Access-Control-Allow-Origin *; try_files $uri.html $uri $uri/ @extensionless-php; } location @extensionless-php { rewrite ^(.*)/$ $1.php last; rewrite ^(.*)$ $1.php last; } location /cgi-bin { gzip off; include fastcgi_params; fastcgi_pass unix:/var/run/fcgiwrap.socket; } ## pleroma # location /.well-known/webfinger { # if ( $query_string ~ resource=acct:(?[^@]+)@envs\.net ) { # return 302 https://pleroma.envs.net/.well-known/webfinger?resource=acct:$username@pleroma.envs.net; # } # } ## matrix location /.well-known/matrix/support { add_header Access-Control-Allow-Origin '*'; add_header Content-Type application/json; return 200 '{"admins": [{"matrix_id": "@creme:envs.net", "email_address": "hostmaster@envs.net", "role": "admin"}], "support_page": "https://matrix.to/#/#envs:envs.net"}'; } location /.well-known/matrix/server { add_header Access-Control-Allow-Origin '*'; add_header Content-Type application/json; return 200 '{"m.server": "matrix.envs.net:443"}'; } location /.well-known/matrix/client { add_header Access-Control-Allow-Origin '*'; add_header Content-Type application/json; return 200 '{"m.homeserver": {"base_url": "https://matrix.envs.net"}, "m.integrations": {"managers": [{"ui_url": "https://dimension.envs.net/riot", "api_url": "https://dimension.envs.net/api/v1/scalar"}, {"ui_url": "https://scalar.vector.im/", "api_url": "https://scalar.vector.im/api"}]}, "m.integrations_widget": {"url": "https://dimension.envs.net/riot", "data": {"api_url": "https://dimension.envs.net/api/v1/scalar"}}, "m.tile_server": {"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=jrKVgM1ozvdgREfvtZ8X"}}'; } location ~ ^/_matrix(/media|/maubot) { include proxy_params; proxy_ssl_name $http_host; proxy_ssl_server_name on; proxy_pass https://matrix.envs.net; } location ^~ /_matrix/maubot/v1/logs { include proxy_params; proxy_ssl_name $http_host; proxy_ssl_server_name on; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_pass https://matrix.envs.net; } ## users location ~ ^/(~|u/)(?[\w-]+)(?/.*)?$ { alias /home/$user/public_html$user_uri; index index.html index.php index.cgi index.py index.sh index.pl index.lua; autoindex on; autoindex_exact_size off; #fancyindex on; #fancyindex_exact_size off; add_header X-Frame-Options SAMEORIGIN; error_page 404 /~$user/404.html; location ~ [^/]\.php(/|$) { include snippets/php_common; } location ~ (\.cgi|\.py|\.sh|\.pl|\.lua|\/cgi-bin)$ { gzip off; include fastcgi_params; fastcgi_pass unix:/var/run/fcgiwrap.socket; fastcgi_param SCRIPT_FILENAME /home/$user/public_html$request_filename; } location ~ /restricted/ { auth_basic "Restricted Area"; auth_basic_user_file /home/$user/.htpasswd; } } location ~* /\.(eot|ttf|woff|woff2)$ { add_header Access-Control-Allow-Origin *; expires 365d; } location ~* /\.(jpg|jpeg|png|gif|ico|css|js)$ { add_header Access-Control-Allow-Origin *; expires 365d; } location ~* /\.(pdf)$ { expires 30d; } location ~ /(\.ht|\.git)$ { deny all; } # aliases location /coc { return 301 https://envs.net/code-of-conduct; } location /tos { return 301 https://envs.net/terms-of-service; } location /help { return 301 https://help.envs.net/; } location /irc { return 301 https://envs.net/chat/irc/; } location /matrix { return 301 https://envs.net/chat/matrix/; } location /matrix/help { return 301 https://matrix-help.envs.net/; } location /chat/matrix/doc { return 301 https://matrix-help.envs.net/; } location /chat/matrix/help { return 301 https://matrix-help.envs.net/; } # include php and ssi include snippets/php.conf; ssi on; }