2013-05-27 05:40:16 +10:00
|
|
|
upstream app_server {
|
|
|
|
server 127.0.0.1:12000 fail_timeout=0;
|
|
|
|
}
|
|
|
|
|
2014-12-13 06:06:29 +11:00
|
|
|
# Combined log with remote:local port logged
|
|
|
|
log_format combined_port '$remote_addr - $remote_user [$time_local] '
|
|
|
|
'"$request" $status $body_bytes_sent '
|
|
|
|
'"$http_referer" "$http_user_agent" "$remote_port:$server_port"';
|
|
|
|
|
2013-06-06 04:44:31 +10:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Redirect all sort of non-ssl (with and without www) to ssl without www
|
|
|
|
# -----------------------------------------------------------------------------
|
2013-05-27 05:40:16 +10:00
|
|
|
server {
|
|
|
|
listen 80;
|
2014-12-13 06:06:29 +11:00
|
|
|
server_name ~(www\.)?dpaste\.(de|org);
|
2013-05-29 08:35:01 +10:00
|
|
|
|
|
|
|
location / {
|
|
|
|
rewrite ^ https://$server_name$request_uri? permanent;
|
|
|
|
}
|
2013-05-27 19:26:36 +10:00
|
|
|
}
|
2013-05-27 05:40:16 +10:00
|
|
|
|
2013-06-06 04:44:31 +10:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# SSL Hosts
|
|
|
|
# -----------------------------------------------------------------------------
|
2014-12-13 06:06:29 +11:00
|
|
|
|
|
|
|
server {
|
|
|
|
listen 443 ssl;
|
|
|
|
server_name dpaste.org www.dpaste.org;
|
|
|
|
|
|
|
|
ssl_certificate /srv/dpaste.de/var/ssl/dpaste_org_unified.crt;
|
|
|
|
ssl_certificate_key /srv/dpaste.de/var/ssl/dpaste_org.key;
|
|
|
|
add_header Strict-Transport-Security max-age=25200;
|
|
|
|
|
|
|
|
# Redirect to dpaste.de
|
|
|
|
location / {
|
|
|
|
rewrite ^/(.*)$ https://dpaste.de/$1 permanent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-27 19:26:36 +10:00
|
|
|
server {
|
2014-12-13 06:06:29 +11:00
|
|
|
listen 443 ssl;
|
2013-06-06 04:46:55 +10:00
|
|
|
server_name dpaste.de www.dpaste.de;
|
2013-05-31 19:47:02 +10:00
|
|
|
|
2013-05-29 08:35:01 +10:00
|
|
|
ssl_certificate /srv/dpaste.de/var/ssl/dpaste_de_unified.crt;
|
|
|
|
ssl_certificate_key /srv/dpaste.de/var/ssl/dpaste_de.key;
|
2014-12-13 06:06:29 +11:00
|
|
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
|
|
|
ssl_ciphers AES256+EECDH:AES256+EDH;
|
|
|
|
ssl_session_cache builtin:1000 shared:SSL:5m;
|
|
|
|
ssl_prefer_server_ciphers on;
|
2013-05-27 05:40:16 +10:00
|
|
|
|
2014-12-13 06:06:29 +11:00
|
|
|
add_header Strict-Transport-Security max-age=25200;
|
|
|
|
|
2013-06-06 04:44:31 +10:00
|
|
|
# Rewrite www to non-www
|
2013-09-28 05:28:07 +10:00
|
|
|
if ($host = www.dpaste.de) {
|
2013-06-06 04:44:31 +10:00
|
|
|
rewrite ^/(.*)$ https://dpaste.de/$1 permanent;
|
|
|
|
}
|
|
|
|
|
2014-12-13 06:06:29 +11:00
|
|
|
access_log /srv/dpaste.de/var/nginx.access.log combined_port;
|
|
|
|
error_log /srv/dpaste.de/var/nginx.error.log;
|
2013-06-06 04:44:31 +10:00
|
|
|
|
2014-12-13 06:06:29 +11:00
|
|
|
keepalive_timeout 5;
|
|
|
|
client_max_body_size 4G;
|
2013-05-27 05:40:16 +10:00
|
|
|
|
2014-12-13 06:06:29 +11:00
|
|
|
location /media/ {
|
|
|
|
alias /srv/dpaste.de/var/media/;
|
|
|
|
}
|
2013-05-29 09:00:41 +10:00
|
|
|
|
2014-12-13 06:06:29 +11:00
|
|
|
location /static/ {
|
|
|
|
alias /srv/dpaste.de/var/static/;
|
2013-06-06 04:44:31 +10:00
|
|
|
}
|
|
|
|
|
2014-12-13 06:06:29 +11:00
|
|
|
location / {
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_redirect off;
|
|
|
|
proxy_buffering off;
|
|
|
|
if (!-f $request_filename) {
|
|
|
|
proxy_pass http://app_server;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-05-27 05:40:16 +10:00
|
|
|
}
|
2014-12-13 06:06:29 +11:00
|
|
|
|