Thanks. I added that, here is what I have in the file right now:
This file staging-mysite-com (with no file extension) was added to /etc/nginx/sites-available:
server_tokens off; # for security-by-obscurity: stop displaying nginx version
# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# HTTP
server {
listen 80 default_server; # if this is not a default server, remove "default_server"
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html; # root is irrelevant
index index.html index.htm; # this is also irrelevant
server_name staging-mysite.com; # the domain on which we want to host the application. Since we set "default_server" previously, nginx will answer all hosts anyway.
# for Let's Encrypt to work properly
location ^~ /.well-known {
root /var/www/;
default_type "text/plain";
allow all;
}
# redirect non-SSL to SSL
location / {
rewrite ^ https://$server_name$request_uri? permanent;
}
}
# HTTPS server
server {
listen 443 ssl spdy; # we enable SPDY here
server_name todos.net; # this domain must match Common Name (CN) in the SSL certificate
root html; # irrelevant
index index.html; # irrelevant
ssl_certificate /etc/letsencrypt/live/staging.mysite.com/fullchain.pem; # full path to SSL certificate and CA certificate concatenated together
ssl_certificate_key /etc/letsencrypt/live/staging.mysite.com/privkey.pem; # full path to SSL key
# performance enhancement for SSL
ssl_stapling on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
# safety enhancement to SSL: make sure we actually use a safe cipher
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK';
# config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
# to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
add_header Strict-Transport-Security "max-age=31536000;";
# If your application is not compatible with IE <= 10, this will redirect visitors to a page advising a browser update
# This works because IE 11 does not present itself as MSIE anymore
if ($http_user_agent ~ "MSIE" ) {
return 303 https://browser-update.org/update.html;
}
# pass all requests to Meteor
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; # allow websockets
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
# this setting allows the browser to cache the application in a way compatible with Meteor
# on every applicaiton update the name of CSS and JS file is different, so they can be cache infinitely (here: 30 days)
# the root path (/) MUST NOT be cached
if ($uri != '/') {
expires 30d;
}
}
}
But I’m still getting the same error when running the following command:
./letsencrypt-auto certonly -a webroot --webroot-path=/var/www -d staging.my-site.com
Domain: stagin.my-site.com
Type: unauthorized
Detail: Invalid response from
http://staging.my-site.com/.well-known/acme-challenge/gQ_sdfasdfaspMyDxrgYl8:
"<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" class="__meteor-css__"
href="/asdfasdfasdf"
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.
My A Record is pointing to the old EC2 instance IP that is currently hosting staging.my-site.com. Do I need to change that A Record to point to the new EC2 instance IP i’m trying to install these new tools and SSL on?
UPDATE:
This is the letsencrypt.log debug dump:
2016-12-17 21:54:01,727:DEBUG:certbot.main:Root logging level set at 20
2016-12-17 21:54:01,727:INFO:certbot.main:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2016-12-17 21:54:01,732:DEBUG:certbot.main:certbot version: 0.9.3
2016-12-17 21:54:01,732:DEBUG:certbot.main:Arguments: ['-a', 'webroot', '--webroot-path=/var/www', '-d', 'staging.my-site.com']
2016-12-17 21:54:01,732:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#standalone,PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#webroot,PluginEntryPoint#apache,PluginEntryPoint#null)
2016-12-17 21:54:01,735:DEBUG:certbot.plugins.selection:Requested authenticator webroot and installer None
2016-12-17 21:54:01,738:DEBUG:certbot.plugins.selection:Single candidate plugin: * webroot
Description: Place files in webroot directory
Interfaces: IAuthenticator, IPlugin
Entry point: webroot = certbot.plugins.webroot:Authenticator
Initialized: <certbot.plugins.webroot.Authenticator object at 0x7fbea6a31550>
Prep: True
2016-12-17 21:54:01,738:DEBUG:certbot.plugins.selection:Selected authenticator <certbot.plugins.webroot.Authenticator object at 0x7fbea6a31550> and installer None
2016-12-17 21:54:01,876:DEBUG:certbot.main:Picked account: <Account(057f5d2438cc6f04a918831750818c99)>
2016-12-17 21:54:01,877:DEBUG:root:Sending GET request to https://acme-v01.api.letsencrypt.org/directory. args: (), kwargs: {}
2016-12-17 21:54:01,879:INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
2016-12-17 21:54:02,405:DEBUG:requests.packages.urllib3.connectionpool:"GET /directory HTTP/1.1" 200 352
2016-12-17 21:54:02,406:DEBUG:root:Received <Response [200]>. Headers: {'Content-Length': '352', 'Expires': 'Sat, 17 Dec 2016 21:54:02 GMT', 'Boulder-Request-Id': '3lf3Wb0ggSK52Rgm9bI0huFuxwGuf7Zf0iy_OR0Kd5A', 'Strict-Transport-Security': 'max-age=604800', 'Server': 'nginx', 'Connection': 'keep-alive', 'Pragma': 'no-cache', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Date': 'Sat, 17 Dec 2016 21:54:02 GMT', 'X-Frame-Options': 'DENY', 'Content-Type': 'application/json', 'Replay-Nonce': 'H3c0E1X3-50_9ytcQ0mO291WZlOpLdO44lYR23RMLos'}. Content: '{\n "key-change": "https://acme-v01.api.letsencrypt.org/acme/key-change",\n "new-authz": "https://acme-v01.api.letsencrypt.org/acme/new-authz",\n "new-cert": "https://acme-v01.api.letsencrypt.org/acme/new-cert",\n "new-reg": "https://acme-v01.api.letsencrypt.org/acme/new-reg",\n "revoke-cert": "https://acme-v01.api.letsencrypt.org/acme/revoke-cert"\n}'
2016-12-17 21:54:02,406:DEBUG:acme.client:Received response <Response [200]> (headers: {'Content-Length': '352', 'Expires': 'Sat, 17 Dec 2016 21:54:02 GMT', 'Boulder-Request-Id': '3lf3Wb0ggSK52Rgm9bI0huFuxwGuf7Zf0iy_OR0Kd5A', 'Strict-Transport-Security': 'max-age=604800', 'Server': 'nginx', 'Connection': 'keep-alive', 'Pragma': 'no-cache', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Date': 'Sat, 17 Dec 2016 21:54:02 GMT', 'X-Frame-Options': 'DENY', 'Content-Type': 'application/json', 'Replay-Nonce': 'H3c0E1X3-50_9ytcQ0mO291WZlOpLdO44lYR23RMLos'}): '{\n "key-change": "https://acme-v01.api.letsencrypt.org/acme/key-change",\n "new-authz": "https://acme-v01.api.letsencrypt.org/acme/new-authz",\n "new-cert": "https://acme-v01.api.letsencrypt.org/acme/new-cert",\n "new-reg": "https://acme-v01.api.letsencrypt.org/acme/new-reg",\n "revoke-cert": "https://acme-v01.api.letsencrypt.org/acme/revoke-cert"\n}'
2016-12-17 21:54:02,407:INFO:certbot.main:Obtaining a new certificate
2016-12-17 21:54:02,412:DEBUG:root:Requesting fresh nonce
2016-12-17 21:54:02,412:DEBUG:root:Sending HEAD request to https://acme-v01.api.letsencrypt.org/acme/new-authz. args: (), kwargs: {}
2016-12-17 21:54:02,475:DEBUG:requests.packages.urllib3.connectionpool:"HEAD /acme/new-authz HTTP/1.1" 405 0
2016-12-17 21:54:02,476:DEBUG:root:Received <Response [405]>. Headers: {'Content-Length': '91', 'Pragma': 'no-cache', 'Boulder-Request-Id': 'dnyIPuymxn3X0OGYW2cvpU9gQwg6Pk1ND_pbSOm_V-U', 'Expires': 'Sat, 17 Dec 2016 21:54:02 GMT', 'Server': 'nginx', 'Connection': 'keep-alive', 'Allow': 'POST', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Date': 'Sat, 17 Dec 2016 21:54:02 GMT', 'Content-Type': 'application/problem+json', 'Replay-Nonce': 'WPzJeFuqJu7uP7C_Pv0WFaC8wvNqXP0F5vnZZdeanig'}. Content: ''
2016-12-17 21:54:02,476:DEBUG:acme.client:Storing nonce: 'X\xfc\xc9x[\xaa&\xee\xee?\xb0\xbf>\xfd\x16\x15\xa0\xbc\xc2\xf3j\\\xfd\x05\xe6\xf9\xd9e\xd7\x9a\x9e('
2016-12-17 21:54:02,476:DEBUG:acme.jose.json_util:Omitted empty fields: combinations=None, challenges=None, status=None, expires=None
2016-12-17 21:54:02,476:DEBUG:acme.client:Serialized JSON: {"identifier": {"type": "dns", "value": "staging.my-site.com"}, "resource": "new-authz"}
2016-12-17 21:54:02,477:DEBUG:acme.jose.json_util:Omitted empty fields: x5c=(), crit=(), kid=None, jwk=None, typ=None, alg=None, jku=None, x5tS256=None, cty=None, x5u=None, x5t=None
2016-12-17 21:54:02,479:DEBUG:acme.jose.json_util:Omitted empty fields: x5c=(), crit=(), kid=None, typ=None, nonce=None, jku=None, x5tS256=None, cty=None, x5u=None, x5t=None