NodeJs代码:
var fs = require('fs');
var http = require('http');
var https = require('https');
var express = require('express');
var app = express();
app .get('/.well-known/acme-challenge/:name', function(req, res) {
var options = {
root: __dirname + '/public/',
dotfiles: 'deny',
headers: {
'x-timestamp': Date.now(),
'x-sent': true
}
};
var fileName = req.params.name;
res.sendFile(fileName, options, function (err) {
if (err) {
next(err);
} else {
console.log('Sent:', fileName);
}
res.redirect("/");
});;})
var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app);
httpServer.listen(80);
httpsServer.listen(443);
尝试从sslforfree.com获得免费的sll证书
我在尝试极限挑战时遇到的错误:
Domain "fittflotta.com" challenge3 failed. Response from "https://acme-v02.api.letsencrypt.org/acme/challenge/tYj3dJCC9HorZkazj1dMNrepfgA43IAbeJ8gaC5vBV0/4174825072" was:
Error: Invalid response from http://fittflotta.com/.well-known/acme-challenge/U3ezyFEBkPOS3q4dvUFkbJAew7ctzUrgJZgb4sIs6H4: " <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>fit"
Full Error: { "type": "http-01", "status": "invalid", "error": { "type": "urn:ietf:params:acme:error:unauthorized", "detail": "Invalid response from http://fittflotta.com/.well-known/acme-challenge/U3ezyFEBkPOS3q4dvUFkbJAew7ctzUrgJZgb4sIs6H4: \"\r\n\u003c!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\r\n \"http://www.w3.org/TR/html4/strict.dtd\"\u003e\r\n\u003chtml\u003e\r\n\r\n\u003chead\u003e\r\n \u003ctitle\u003efit\"", "status": 403 }, "url": "https://acme-v02.api.letsencrypt.org/acme/challenge/tYj3dJCC9HorZkazj1dMNrepfgA43IAbeJ8gaC5vBV0/4174825072", "token": "U3ezyFEBkPOS3q4dvUFkbJAew7ctzUrgJZgb4sIs6H4", "validationRecord": [ { "url": "http://fittflotta.com/eVkTh/.well-known/acme-challenge/U3ezyFEBkPOS3q4dvUFkbJAew7ctzUrgJZgb4sIs6H4", "hostname": "fittflotta.com", "port": "80", "addressesResolved": [ "50.63.202.23" ], "addressUsed": "50.63.202.23" }, { "url": "http://fittflotta.com/.well-known/acme-challenge/U3ezyFEBkPOS3q4dvUFkbJAew7ctzUrgJZgb4sIs6H4", "hostname": "fittflotta.com", "port": "80", "addressesResolved": [ "50.63.202.23" ], "addressUsed": "50.63.202.23" }, { "url": "http://fittflotta.com/.well-known/acme-challenge/U3ezyFEBkPOS3q4dvUFkbJAew7ctzUrgJZgb4sIs6H4", "hostname": "fittflotta.com", "port": "80", "addressesResolved": [ "50.63.202.23" ], "addressUsed": "50.63.202.23" } ] }
如果有什么我需要提供的话我怎么能解决这个问题我愿意:) 谢谢?