Tag Info

Hot answers tagged

117

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. ...


52

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.36).


44

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.


24

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 ...


23

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.


22

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. ...


20

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 ...


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 ...


12

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


11

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) { ...


11

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.


11

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 ...


10

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 ...


10

[Edit] Thank you David for pointing out in the comments below that the nodejs.tchol.org site is now pointing to a spam site (sic!).. So this answer doesn't work anymore, don't use it! 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 ...


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 ...


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


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

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.


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

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. ...


8

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 ...


8

Jenkins kills all process spawn by the job. This can be disabled by setting the BUILD_ID environment variable to something else: export BUILD_ID=dontKillMe see https://wiki.jenkins-ci.org/display/JENKINS/ProcessTreeKiller for details


7

Nginx connects to nodjs on the IPv6 loopback [::1]. nodejs is probably just listening on IPv4. Try setting upstream api { server 127.0.0.1:5000; } ...


7

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) ...


7

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 ...


7

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 ...


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

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

The answers above are outdated AS ROOT curl -sL https://rpm.nodesource.com/setup | bash - yum install -y nodejs and you are done. verify your install with node -v



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