2014-07-28 16:52:00 +02:00
|
|
|
# Choose between www and non-www, listen on the *wrong* one and redirect to
|
|
|
|
# the right one -- http://wiki.nginx.org/Pitfalls#Server_Name
|
|
|
|
#
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
|
|
|
|
# listen on both hosts
|
|
|
|
server_name example.com www.example.com;
|
|
|
|
|
2014-08-07 14:01:30 +02:00
|
|
|
include h5bp/direcive-only/ssl.conf;
|
2014-07-28 16:52:00 +02:00
|
|
|
|
|
|
|
# and redirect to the https host (declared below)
|
|
|
|
# avoiding http://www -> https://www -> https:// chain.
|
|
|
|
return 301 https://example.com$request_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 443 ssl spdy;
|
|
|
|
|
|
|
|
# listen on the wrong host
|
|
|
|
server_name www.example.com;
|
|
|
|
|
2014-08-07 14:01:30 +02:00
|
|
|
include h5bp/direcive-only/ssl.conf;
|
2014-07-28 16:52:00 +02:00
|
|
|
|
|
|
|
# and redirect to the non-www host (declared below)
|
|
|
|
return 301 https://example.com$request_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 443 ssl spdy;
|
|
|
|
|
|
|
|
# The host name to respond to
|
|
|
|
server_name example.com;
|
|
|
|
|
2014-08-07 14:01:30 +02:00
|
|
|
include h5bp/direcive-only/ssl.conf;
|
2014-07-28 16:52:00 +02:00
|
|
|
|
|
|
|
# Path for static files
|
|
|
|
root /sites/example.com/public;
|
|
|
|
|
|
|
|
#Specify a charset
|
|
|
|
charset utf-8;
|
|
|
|
|
|
|
|
# Custom 404 page
|
|
|
|
error_page 404 /404.html;
|
|
|
|
|
|
|
|
# Include the basic h5bp config set
|
|
|
|
include h5bp/basic.conf;
|
|
|
|
}
|