Tag Info

Hot answers tagged

103

su - yum install gcc-c++ openssl-devel cd /usr/local/src wget http://nodejs.org/dist/node-latest.tar.gz tar zxvf node-latest.tar.gz (cd into extracted folder: ex "cd node-v0.10.3") ./configure make make install Note that this requires Python 2.6+ to use ./configure above. You can modify the "configure" file to point to python2.7 in line 1 if necessary. ...


43

You would need to use a reverse proxy to do this, e.g. Apache 2.4. with mod_proxy_wstunnel. Use it as a frontend and then tunnel the connections to the appropriate backend.


41

If you have CentOS 6.x, and have enabled the EPEL repository, you can use yum to install node/npm: $ sudo yum install npm After the installation is complete, check to make sure node is setup properly: $ node -v (Should return something like v0.10.4).


23

The gist "Installing Node.js via package manager" does NOT contain instructions for installing nodejs on CentOS any more. Since Fedora 18, nodejs becomes part of the standard repo. I try "epel-fedora-nodejs" repo, and find it no longer update, leaving the version at the outdated 0.6.0. The good news is that, we have nave, a Virtual Environments for Node, to ...


21

Check out this link: http://cuppster.com/2011/05/12/diy-node-js-server-on-amazon-ec2 For load balancing and static content delivering i would use nginx.


21

Only a single process can listen on a particular port for the same IP address and protocol, because otherwise operating system wouldn't know which process to send the received packet to. To achieve what you want you will have to use a reverse proxy which will listen on port 80 and forward traffic to correct destination. There are multiple ways to do this. ...


13

Something like exec { "install npm": command => "/usr/bin/curl http://npmjs.org/install.sh | sh", creates => "/some/directory/somewhere" } Should do the trick. However, I would strongly advise against doing this, as it makes your installation process dependent on so many other things working correctly, and drops untracked files ...


11

For CentOS yum install gcc-c++ make git cd /usr/local/src/ git clone git://github.com/joyent/node.git cd node ./configure make make install


10

There are about a zillion ways to do this but: netstat | grep http | wc -l Keep it mind that http is a stateless protocol. Each line can represent one client opening multiple sockets to grab different files (css, images, etc) that will hang out for awhile in a timewait state.


10

I can confirm that the method Chris explained in his solution does work in CentOS 5.4 (i've done it a minute ago :)) wget http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm yum localinstall --nogpgcheck nodejs-stable-release.noarch.rpm yum install nodejs-compat-symlinks npm PS: of course you must be root (or use sudo) in order to install ...


9

Plurk.com uses Node.js for their Comet engine, they have a fairly high traffic load too. Blog post about Plurk using Node.js


9

As noted above, "tchol.org" is gone, leaving CentOS folks looking at either abandoning use of a package manager, or switching to another OS. I made a pact with myself against every doing the former (again) on all but experimental / dev boxes. Fortunately, there are rpms still available at: http://patches.fedorapeople.org/oldnode/stable/el6/x86_64/ Just ...


8

Since node.js has not been around long enough to have satisfied the greater community that it's stable and secure, many production deployments use Apache or nginx as a web server that proxies http requests to node running on a different port that is not accessible from the machine's public IP address. Also forever may be able to help with the node stability ...


8

Thanks for adding the last netstat output, it really helped. You can't access node.js from outside because it is listening on localhost IP i.e 127.0.0.1. You need to configure node.js to listen on 0.0.0.0 so it will be able to accept connections on all the IPs of your machine. var http = require('http'); http.createServer(function (req, res) { ...


8

Used forever as a daemon tool in past projects. It'll automatically restart your node.js scripts if they crash. Also, it can start and manage multiple node processes and maintain a log file for each of them individually. However it doesn't start the scripts on reboot. Read a couple of times that people were using Upstart to make the initial launch of ...


8

Use Rewrite conditions to match for this special case: RewriteEngine On RewriteCond %{REQUEST_URI} ^/socket.io [NC] RewriteCond %{QUERY_STRING} transport=websocket [NC] RewriteRule /(.*) ws://localhost:8082/$1 [P,L] ProxyPass /socket.io http://localhost:8082/socket.io ProxyPassReverse /socket.io ...


7

Changing LogLevel to debug will give you more information in error.log. Please do so and post the results. Without that information, I have a guess that changing your ProxyPass line to ProxyPass http://127.0.0.1:3000/ retry=0 might help. In general, the Apache mod_proxy documentation has more details on the parameters available to you.


7

The startup event is the very first event that gets emitted in the Upstart bootup process. There are all kinds of things that won't have happened yet - the root filesystem will still be mounted read-only, networking hasn't been initialized, etc. I suspect that the job is exiting quickly because all of its dependencies (explicit or implicit) aren't ...


7

There's one more approach I haven't seen listed in any of the other answers, and that is to use the binary distributions for Linux which have been published since 0.8.6 Here's the script I use: # get the latest stable binary latest_node=$(curl http://nodejs.org/dist/latest/SHASUMS.txt | grep 'linux-x64.tar.gz' | awk '{ print $2 }') wget -O ...


7

After few days of intense trial and errors, I'm glad to be able to say that I've understood where the bottleneck was, and I'll post it here so that other people can benefit from my findings. The problem lies in the pub/sub connections that I was using with socket.io, and in particular in the RedisStore used by socket.io to handle inter-process ...


7

NPM isn't packaged for EPEL 7 yet. Give it some time, they are having to update thousands of packages already and had to wait for the CentOS release which was just a couple of days ago. I suggest contacting the package maintainer (who appears to be patches) as they may not be aware that CentOS 7 is released and that they can now build their packages for it. ...


6

At the IP level, there is no such thing as a hostname. A hostname is an application-level abstraction of an IP address, and at the Internet or Transport layers they hold no meaning. In HTTP shared hosting, this trick is abstracted in the process of handling the HTTP conversation, which happens after the TCP conversation is started. It is for this reason ...


6

First start with reading the wiki documentation. It's very thorough and includes samples. I won't give you an entire nginx config, but here is the relevant portion to your question. server { listen 80; server_name example.com; location /foo { proxy_pass http://localhost:9000; } location /bar { proxy_pass ...


6

This worked for me on CentOS 5.7: yum install openssl-devel yum install python27 yum install gcc-c++ cd /usr/local/src wget http://nodejs.org/dist/node-latest.tar.gz tar zxvf node-latest.tar.gz cd node-v[tab] python2.7 configure make PYTHON=python2.7 make install


6

Having just setup a project that is essentially identical to what you describe, I'll share my approach - no guarantees that it is 'the best', but it does work. My server stack is Varnish (v3.0.2) - all interfaces, port 80 Nginx (v1.0.14) - local interface, port 81 Node.js (v0.6.13) - local interface, port 1337 Operating system is CentOS 6.2 (or similar) ...


6

By default SELinux only allows the web server to make outbound connections to a limited set of ports. # semanage port --list http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000 To fix the problem, you simply need to add your own desired port number to the list. # semanage port --add --type http_port_t --proto tcp 7777 Then ...


5

According to your netstat output, port 8080 is open only for 127.0.0.1 which is localhost, hence accessing from the server works (which is localhost), but not from anywhere else. The right output should look like 0.0.0.0:8080


5

Although I can't point to any specific reported defects, I'd be nervous about the node.js architecture - where your code runs as part of the webserver code. While with something like mod_php, there is still only a single process handling both the HTTP and logic tiers, there is a clear functional separation between the 2, and the interface between the ...


5

What you probably need is mod_proxy and ProxyPass for Apache. Run Apache on port 80, and use the <Location> config in Apache to pass the query along to Node.js which would be on another port e.g. 8080. <Location /<appname>/> ProxyPass http://nodejsip:8080/ </Location>


5

Presumably you mean this example: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, "127.0.0.1"); console.log('Server running at http://127.0.0.1:1337/'); The message you would have received like so is Server running at ...



Only top voted, non community-wiki answers of a minimum length are eligible