1

Because our Node.js app need to run the service with koa.js, so the processes need to be started with --harmony flag.

Like this.

$ node --harmony app.js

But how can I configure the passenger to run the app with it?

iwillwen
  • 13
  • 4

1 Answers1

2

You can do this by writing a wrapper script that executes the real node with --harmony, then instruct Passenger to use that wrapper script. For example, create /home/user/wrappers/node:

#!/bin/sh
exec /usr/bin/node --harmony "$@"

Then:

chmod +x /home/user/wrappers/node

Passenger Standalone uses the first 'node' command in PATH, so you can do this:

export PATH=/home/user/wrappers:$PATH
cd /your-app
passenger start

If you use Passenger for Apache or Passenger for Nginx, set the appropriate directives:

# Apache
PassengerNodejs /home/user/wrappers/node

# Nginx
passenger_nodejs /home/user/wrappers/node;
Hongli
  • 18,682
  • 15
  • 79
  • 107
  • Well I see, I have not read completely the passenger documentation. Thanks. – iwillwen May 02 '14 at 12:33
  • 3
    if you use Apache or Nginx, you could just write the command directly `passenger_nodejs 'node --harmony app.js';` – guzart Feb 09 '15 at 02:12
  • Adding flags to the `passenger_nodejs` directive didn't work for me, I had to use the wrapper as mentioned above. – Jondlm Jun 29 '17 at 14:44