WebFaction
Community site: login faq

Hi! Is it possible to use Passenger not with Rails, but with Node.js? And how to do it, if yes?…

asked 19 May '14, 10:09

zela
134
accept rate: 0%


Yes, you can run Node.js under Passenger on our service, and it's super-easy!

  1. Create a Node app (latest version) via our control panel. In this example, I'll name the app "mynode".
  2. Create a Passenger app (latest version) via our control panel. In this example, I'll name the app "mypass".
  3. Assign the Passenger app to a website.
  4. SSH into your server.
  5. Edit your crontab to comment out the job that starts your node app.
  6. Go to your node app directory: cd ~/webapps/mynode
  7. Stop the node app: ./bin/stop
  8. Make your public and tmp directories for passenger: mkdir public tmp
  9. Rename hello-world.js to app.js: mv hello-world.js app.js
  10. Go to your Passenger app directory: cd ~/webapps/mypass
  11. Edit conf/nginx.conf to remove the Rails stuff and add the Node stuff. The final config should look something like this (with the exceptions of paths and ports, which will be different for your own app): http://pastie.org/9191194
  12. Save the file and then restart your Nginx: ./bin/stop; ./bin/start.

That's it, you're done! Your node app is now served by the Passenger app you created in step 2, on the site you configured in step 3. :)

permanent link

answered 20 May '14, 00:13

seanf
12.2k41836
accept rate: 37%

edited 20 May '14, 00:20

Thank you very much for this comprehensive instruction!

I'll save here nginx config from pastie.org, because in unconfined russian internet there are problems with access to this site. =)

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    access_log  /home/username/logs/user/access_mypass.log  combined;
    error_log   /home/username/logs/user/error_mypass.log   crit;

    include         mime.types;
    passenger_root /home/username/webapps/mypass/.src/passenger-4.0.41;
    passenger_nodejs /home/username/webapps/mynode/bin/node;
    sendfile        on;

    server {
        listen             26904;
        passenger_enabled  on;
        root               /home/username/webapps/mynode/public;
        server_name        localhost;
    }
}
(20 May '14, 13:50) zela
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×67
×25

question asked: 19 May '14, 10:09

question was seen: 2,109 times

last updated: 20 May '14, 14:59

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM