小编Gre*_*reg的帖子

使用Node JS设置Cloud9 SSL应用程序

我一直在玩Cloud9 IDE并且玩得很开心.但是,我正在尝试使用节点js设置一个简单的https服务器,我似乎无法让它工作.当我运行页面时,Cloud9会说"正在运行节点进程"但是当我访问服务器应该响应的URL时:https://workspace.user.c9.io该页面说

Service Temporarily Unavailable

The server you are trying to contact is down either because it was stopped or is unable to service your request due to maintenance downtime or capacity problems. Please try again later.
node-web-proxy/0.4 Server at project-livec9f70a01ca28.rhcloud.com Port 8000 
Run Code Online (Sandbox Code Playgroud)

我用OPENSSL创建了一个测试证书,并使用以下代码来设置我的服务器.我可以确认OPENSSL证书是否正确构建.

var https = require("https");
var fs = require("fs");
var url = require("url");

var options = {
    key: fs.readFileSync('certs/cert.pem'),
    cert: fs.readFileSync('certs/cert.pem')
};


// create a server

https.createServer(options, function(req, res) {

    console.log("This works!");

    res.writeHead(200); …
Run Code Online (Sandbox Code Playgroud)

ssl https configuration node.js

9
推荐指数
1
解决办法
1546
查看次数

标签 统计

configuration ×1

https ×1

node.js ×1

ssl ×1