diff --git a/lib/webroot.js b/lib/webroot.js index 81b4eb6..e2dba79 100644 --- a/lib/webroot.js +++ b/lib/webroot.js @@ -11,15 +11,16 @@ module.exports.create = function (defaults) { // _challenges: {} , setChallenge: function (args, key, value, cb) { - mkdirp(defaults.webrootPath, function (err) { + var challengePath = path.join(defaults.webrootPath, '.well-known', 'acme-challenge'); + mkdirp(challengePath, function (err) { if (err) { - console.error("Could not create --webroot-path '" + defaults.webrootPath + "':", err.code); + console.error("Could not create --webroot-path '" + challengePath + "':", err.code); console.error("Try checking the permissions, maybe?"); cb(err); return; } - var keyfile = path.join(defaults.webrootPath, key); + var keyfile = path.join(challengePath, key); fs.writeFile(keyfile, value, 'utf8', function (err) { if (err) { @@ -35,7 +36,7 @@ module.exports.create = function (defaults) { // handled as file read by web server // , getChallenge: function (args, key, cb) {} , removeChallenge: function (args, key, cb) { - var keyfile = path.join(defaults.webrootPath, key); + var keyfile = path.join(defaults.webrootPath, '.well-known', 'acme-challenge', key); fs.unlink(keyfile, function (err) { if (err) {