mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Added a https www-to-non-www redirect.
This commit is contained in:
parent
f6f04901d6
commit
9b1d06a919
1 changed files with 21 additions and 4 deletions
|
@ -2,9 +2,12 @@ upstream app_server {
|
||||||
server 127.0.0.1:12000 fail_timeout=0;
|
server 127.0.0.1:12000 fail_timeout=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Redirect all sort of non-ssl (with and without www) to ssl without www
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name dpaste.de dpaste.org;
|
server_name dpaste.de www.dpaste.de dpaste.org www.dpaste.org;
|
||||||
|
|
||||||
# Do not redirect to SSL for API calls (some clients dont support
|
# Do not redirect to SSL for API calls (some clients dont support
|
||||||
# this automatically)
|
# this automatically)
|
||||||
|
@ -17,6 +20,9 @@ server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# SSL Hosts
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
server {
|
server {
|
||||||
listen 443;
|
listen 443;
|
||||||
server_name dpaste.de;
|
server_name dpaste.de;
|
||||||
|
@ -25,6 +31,12 @@ server {
|
||||||
ssl_certificate /srv/dpaste.de/var/ssl/dpaste_de_unified.crt;
|
ssl_certificate /srv/dpaste.de/var/ssl/dpaste_de_unified.crt;
|
||||||
ssl_certificate_key /srv/dpaste.de/var/ssl/dpaste_de.key;
|
ssl_certificate_key /srv/dpaste.de/var/ssl/dpaste_de.key;
|
||||||
|
|
||||||
|
|
||||||
|
# Rewrite www to non-www
|
||||||
|
if ($host ~ /^www\./) {
|
||||||
|
rewrite ^/(.*)$ https://dpaste.de/$1 permanent;
|
||||||
|
}
|
||||||
|
|
||||||
add_header Strict-Transport-Security max-age=25200;
|
add_header Strict-Transport-Security max-age=25200;
|
||||||
|
|
||||||
include /srv/dpaste.de/src/dpaste/server/nginx_server.conf;
|
include /srv/dpaste.de/src/dpaste/server/nginx_server.conf;
|
||||||
|
@ -40,5 +52,10 @@ server {
|
||||||
|
|
||||||
add_header Strict-Transport-Security max-age=25200;
|
add_header Strict-Transport-Security max-age=25200;
|
||||||
|
|
||||||
|
# Rewrite www to non-www
|
||||||
|
if ($host ~ /^www\./) {
|
||||||
|
rewrite ^/(.*)$ https://dpaste.org/$1 permanent;
|
||||||
|
}
|
||||||
|
|
||||||
include /srv/dpaste.de/src/dpaste/server/nginx_server.conf;
|
include /srv/dpaste.de/src/dpaste/server/nginx_server.conf;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue