dpaste/server/nginx.conf

62 lines
1.7 KiB
Nginx Configuration File
Raw Permalink Normal View History

upstream app_server {
server 127.0.0.1:12000 fail_timeout=0;
}
2013-06-06 04:44:31 +10:00
# -----------------------------------------------------------------------------
# Redirect all sort of non-ssl (with and without www) to ssl without www
# -----------------------------------------------------------------------------
server {
listen 80;
2013-06-06 04:44:31 +10:00
server_name dpaste.de www.dpaste.de dpaste.org www.dpaste.org;
# Do not redirect to SSL for API calls (some clients dont support
2013-05-29 08:35:01 +10:00
# this automatically)
location /api {
include /srv/dpaste.de/src/dpaste/server/nginx_server_appforward.conf;
}
location / {
rewrite ^ https://$server_name$request_uri? permanent;
}
2013-05-27 19:26:36 +10:00
}
2013-06-06 04:44:31 +10:00
# -----------------------------------------------------------------------------
# SSL Hosts
# -----------------------------------------------------------------------------
2013-05-27 19:26:36 +10:00
server {
listen 443;
2013-06-06 04:46:55 +10:00
server_name dpaste.de www.dpaste.de;
2013-05-31 19:47:02 +10:00
ssl on;
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;
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;
}
2013-05-31 06:42:27 +10:00
add_header Strict-Transport-Security max-age=25200;
2013-05-29 09:00:41 +10:00
2013-05-27 19:26:36 +10:00
include /srv/dpaste.de/src/dpaste/server/nginx_server.conf;
}
2013-05-27 19:26:36 +10:00
server {
listen 443;
2013-06-06 04:46:55 +10:00
server_name dpaste.org www.dpaste.org;
2013-06-06 04:44:31 +10:00
2013-05-27 19:26:36 +10:00
ssl on;
2013-05-29 08:35:01 +10:00
ssl_certificate /srv/dpaste.de/var/ssl/dpaste_org_unified.crt;
ssl_certificate_key /srv/dpaste.de/var/ssl/dpaste_org.key;
2013-05-31 06:42:27 +10:00
add_header Strict-Transport-Security max-age=25200;
2013-05-29 09:00:41 +10:00
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.org) {
2013-06-06 04:44:31 +10:00
rewrite ^/(.*)$ https://dpaste.org/$1 permanent;
}
2013-05-27 19:26:36 +10:00
include /srv/dpaste.de/src/dpaste/server/nginx_server.conf;
}