stripping www and forcing ssl
David Benfell
benfell at mail.parts-unknown.org
Fri Mar 20 18:01:10 UTC 2015
Hi all,
I am attempting to strip www. and force SSL. Here are the blocks I'm
using:
server {
listen 50.250.218.168:80;
listen 50.250.218.168:443 ssl;
listen [2001:470:67:2b5::10]:80;
listen [2001:470:67:2b5::10]:443 ssl;
server_name www.disunitedstates.org;
include ssl_common;
access_log
/var/log/nginx/disunitedstates.org/access.log;
error_log
/var/log/nginx/disunitedstates.org/error.log;
return 301 https://disunitedstates.org$request_uri;
}
server {
listen 50.250.218.168:80;
listen [2001:470:67:2b5::10]:80;
server_name disunitedstates.org;
access_log
/var/log/nginx/disunitedstates.org/access.log;
error_log
/var/log/nginx/disunitedstates.org/error.log;
return 301 https://disunitedstates.org$request_uri;
}
I have a separate server block for actually serving the site.
But when one tries to access http://disunitedstates.org, one gets a
400 error, "The plain HTTP request was sent to HTTPS port." The
information I'm finding out on the web about this is confusing and
contradictory.
How should this be done?
Thanks!
--
David Benfell <benfell at parts-unknown.org>
See https://parts-unknown.org/node/2 if you don't understand the
attachment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150320/d2dc8dfa/attachment.bin>
More information about the nginx
mailing list