简体   繁体   中英

NODE.JS wont listen on Debian Webserver

I have a Debian 6 server that runs several domains.

I have created a new domain (that functions perfectly as a website), but I want to create a node.js scripts that listens on that domain.

Doesn't have to be a specific port, it can be the entire domain as far as I am concerned, but for simplicity I am trying to test on port3000

The directory structure is

domainname/public/(static content)

I am running the node at the domainname/ level.. ie one level below the webcontent. I have a test index.html file in the public folder (which works fine). The test script is

var connect = require('connect');

var app = connect()
    .use(connect.static('public'))
    .use(function (req, res) {
        res.end("Couldn't find it.");
    })
    .listen(3000);

the script runs but going to

http://domainname:3000

just throws me a page cannot be found error.

Any advice would be gratefully appreciated. Either a script change, or a different module maybe

Ultimately, there was too much going on with regards to the server which was already a full functional website.

I ended up creating an EC2 micro instance on AWS, installing NODE afresh, opening up the required port and uploading my code and BOOM worked first time.

Thanks for all those taking time to offer an answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM