126 lines
4.4 KiB
Plaintext
126 lines
4.4 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name diaspora.solusar.de www.diaspora.example.org;
|
|
|
|
location / {
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
}
|
|
|
|
# Redirect https://www.diaspora.example.org to https://diaspora.example.org
|
|
server {
|
|
listen 443 ssl http2; # Same rules as for listen [::]:80 apply.
|
|
|
|
server_name www.diaspora.solusar.de;
|
|
|
|
location / {
|
|
return 301 https://diaspora.solusar.de$request_uri;
|
|
}
|
|
|
|
# SSL setup
|
|
|
|
# This file should also include any necessary intermediate certificates.
|
|
# For example for StartSSL that would be https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem
|
|
# For Let's Encrypt use /etc/letsencrypt/live/diaspora.example.org/fullchain.pem
|
|
# and /etc/letsencrypt/diaspora.example.org/privkey.pem
|
|
ssl_certificate /etc/letsencrypt/live/diaspora.solusar.de/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/diaspora.solusar.de/privkey.pem;
|
|
ssl_trusted_certificate /etc/letsencrypt/live/diaspora.solusar.de/fullchain.pem;
|
|
|
|
# Taken from https://wiki.mozilla.org/Security/Server_Side_TLS
|
|
# You might want to make these global
|
|
|
|
# generate with openssl dhparam 2048 > /path/to/dhparam.pem
|
|
ssl_dhparam /etc/myssl/dh4096.pem;
|
|
ssl_protocols TLSv1.2;
|
|
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK';
|
|
ssl_session_timeout 5m;
|
|
ssl_prefer_server_ciphers on;
|
|
ssl_session_cache shared:SSL:50m;
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
add_header X-Content-Type-Options nosniff;
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
}
|
|
|
|
# Actual proxy
|
|
|
|
server {
|
|
listen 443 ssl http2; # Same rules as for listen [::]:80 apply.
|
|
server_name diaspora.solusar.de;
|
|
root /home/diaspora/diaspora/public;
|
|
|
|
access_log /var/log/nginx/004-diaspora-access.log;
|
|
error_log /var/log/nginx/004-diaspora-error.log;
|
|
|
|
# Configure maximum picture size
|
|
# Note that Diaspora has a client side check set at 4M
|
|
client_max_body_size 5M;
|
|
client_body_buffer_size 256K;
|
|
|
|
# SSL setup
|
|
|
|
# This file should also include any necessary intermediate certificates.
|
|
# For example for StartSSL that would be https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem
|
|
# For Let's Encrypt use /etc/letsencrypt/live/diaspora.example.org/fullchain.pem
|
|
# and /etc/letsencrypt/diaspora.example.org/privkey.pem
|
|
ssl_certificate /etc/letsencrypt/live/diaspora.solusar.de/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/diaspora.solusar.de/privkey.pem;
|
|
ssl_trusted_certificate /etc/letsencrypt/live/diaspora.solusar.de/fullchain.pem;
|
|
|
|
# Taken from https://wiki.mozilla.org/Security/Server_Side_TLS
|
|
# You might want to make these global
|
|
|
|
# generate with openssl dhparam 2048 > /path/to/dhparam.pem
|
|
ssl_dhparam /etc/myssl/dh4096.pem;
|
|
ssl_protocols TLSv1.2;
|
|
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK';
|
|
ssl_session_timeout 5m;
|
|
ssl_prefer_server_ciphers on;
|
|
ssl_session_cache shared:SSL:50m;
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
add_header X-Content-Type-Options nosniff;
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
|
|
# Proxy if requested file not found
|
|
try_files $uri @diaspora;
|
|
|
|
location /assets/ {
|
|
expires max;
|
|
add_header Cache-Control public;
|
|
}
|
|
|
|
# Camo support
|
|
#location /camo/ {
|
|
# proxy_redirect off;
|
|
# proxy_pass http://camo/;
|
|
# break;
|
|
#}
|
|
|
|
location @diaspora {
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
|
|
proxy_pass http://localhost:3000;
|
|
}
|
|
}
|
|
|
|
# Proxy destination
|
|
# Add as many server directives as you want
|
|
# Also takes a socket, like unix:/path/to/some/socket.sock
|
|
#upstream diaspora_server {
|
|
# server unix:/home/diaspora/diaspora/tmp/diaspora.sock;
|
|
#}
|
|
|
|
# Camo support
|
|
#upstream camo {
|
|
# server 127.0.0.1:8081;
|
|
#}
|
|
|