From d4104af544f3ce9d44c6331370dd981abd024442 Mon Sep 17 00:00:00 2001 From: a1batross Date: Sun, 21 Jun 2020 17:14:05 +0200 Subject: [PATCH] config: first blood --- README.md | 16 +++++++++-- soapbox.nginx | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 soapbox.nginx diff --git a/README.md b/README.md index ae4b15d..15d1dbd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ -# soapbox-nginx-config +# SoapboxFE nginx config -Config for serving SoapboxFE through nginx \ No newline at end of file +I like Soapbox FE design but I like PleromaFE more. Still, I want to allow instance users use both so I've made this config. + +## Installation + +1. Move soapbox.nginx to your nginx sites-enabled folder. + +2. Replace soapbox.example.com by domain you're gonna use for Soapbox FE. + +3. Replace example.com by domain of your instance. + +## Reporing bugs + +Either notify @a1batross@expired.mentality.rip on Fediverse, either leave an issue here. diff --git a/soapbox.nginx b/soapbox.nginx new file mode 100644 index 0000000..d55ce54 --- /dev/null +++ b/soapbox.nginx @@ -0,0 +1,78 @@ +server { + server_name soapbox.example.com; + + listen 80; + listen [::]:80; + + # Uncomment this if you need to use the 'webroot' method with certbot. Make sure + # that the directory exists and that it is accessible by the webserver. If you followed + # the guide, you already ran 'mkdir -p /var/lib/letsencrypt' to create the folder. + # You may need to load this file with the ssl server block commented out, run certbot + # to get the certificate, and then uncomment it. + # + location ~ /\.well-known/acme-challenge { + root /var/lib/letsencrypt/; + } + + location / { + return 301 https://$server_name$request_uri; + } +} + +# Enable SSL session caching for improved performance +ssl_session_cache shared:ssl_session_cache:10m; + +server { + server_name soapbox.example.com; + + listen 443 ssl http2; + listen [::]:443 ssl http2; + ssl_session_timeout 5m; + + ssl_trusted_certificate /etc/letsencrypt/live/soapbox.example.com/chain.pem; + ssl_certificate /etc/letsencrypt/live/soapbox.example.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/soapbox.example.com/privkey.pem; + + # Add TLSv1.0 to support older devices + ssl_protocols TLSv1.2; + # Uncomment line below if you want to support older devices (Before Android 4.4.2, IE 8, etc.) + # ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; + ssl_ciphers "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"; + ssl_prefer_server_ciphers on; + # In case of an old server with an OpenSSL version of 1.0.2 or below, + # leave only prime256v1 or comment out the following line. + ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1; + ssl_stapling on; + ssl_stapling_verify on; + + #brotli on; + #brotli_static on; + #brotli_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml; + + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml; + + # the nginx default is 1m, not enough for large media uploads + # a1ba: disabled, I presume Soapbox as based on MastodonFE supports multipart uploads + # also it's anyway being redirected lol + # client_max_body_size 16m; + + root /opt/pleroma/soapbox/static/; + + location / { + try_files $uri /index.html; + } + + location = /index.html { + expires 30s; + } + + # here goes long list of what we will use from real instance + location ~ ^/(api|.well-known|nodeinfo|proxy|media|emoji|oauth|favicon.ico) { + return 308 $scheme://example.com$request_uri; + } +}