SSL settings

This commit is contained in:
Martin Mahner 2013-05-28 22:35:01 +00:00
parent 668c2d71f4
commit a7afa9a944
3 changed files with 26 additions and 15 deletions

View file

@ -5,15 +5,24 @@ upstream app_server {
server { server {
listen 80; listen 80;
server_name dpaste.de dpaste.org; server_name dpaste.de dpaste.org;
include /srv/dpaste.de/src/dpaste/server/nginx_server.conf;
# Do not redirect to SSL for API calls (some clients dont support
# this automatically)
location /api {
include /srv/dpaste.de/src/dpaste/server/nginx_server_appforward.conf;
}
location / {
rewrite ^ https://$server_name$request_uri? permanent;
}
} }
server { server {
listen 443; listen 443;
server_name dpaste.de; server_name dpaste.de;
ssl on; ssl on;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; ssl_certificate /srv/dpaste.de/var/ssl/dpaste_de_unified.crt;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; ssl_certificate_key /srv/dpaste.de/var/ssl/dpaste_de.key;
include /srv/dpaste.de/src/dpaste/server/nginx_server.conf; include /srv/dpaste.de/src/dpaste/server/nginx_server.conf;
} }
@ -22,8 +31,8 @@ server {
listen 443; listen 443;
server_name dpaste.org; server_name dpaste.org;
ssl on; ssl on;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; ssl_certificate /srv/dpaste.de/var/ssl/dpaste_org_unified.crt;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; ssl_certificate_key /srv/dpaste.de/var/ssl/dpaste_org.key;
include /srv/dpaste.de/src/dpaste/server/nginx_server.conf; include /srv/dpaste.de/src/dpaste/server/nginx_server.conf;
} }

View file

@ -1,21 +1,15 @@
server_name dpaste.de dpaste.org;
error_log /srv/dpaste.de/var/nginx.error.log; error_log /srv/dpaste.de/var/nginx.error.log;
keepalive_timeout 5; keepalive_timeout 5;
client_max_body_size 4G; client_max_body_size 4G;
location /media/ { location /media/ {
alias /srv/dpaste.de/var/media/; alias /srv/dpaste.de/var/media/;
} }
location /static/ { location /static/ {
alias /srv/dpaste.de/var/static/; alias /srv/dpaste.de/var/static/;
} }
location / { location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; include /srv/dpaste.de/src/dpaste/server/nginx_server_appforward.conf;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_buffering off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
} }

View file

@ -0,0 +1,8 @@
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;
}