質問

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?

役に立ちましたか?

解決

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;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top