[英]How to use --harmony flag in my node app with phusion passenger?
Because our Node.js app need to run the service with koa.js, so the processes need to be started with --harmony
flag. 因为我们的Node.js应用程序需要与koa.js运行服务,所以流程需要与启动
--harmony
标志。
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. 您可以通过编写一个包装脚本来执行此操作,该脚本使用--harmony执行实际节点,然后指示旅客使用该包装脚本。 For example, create /home/user/wrappers/node:
例如,创建/ 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: 乘客独立版在PATH中使用第一个“ node”命令,因此您可以执行以下操作:
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: 如果将Passenger用于Apache或Passenger用于Nginx,请设置适当的指令:
# Apache
PassengerNodejs /home/user/wrappers/node
# Nginx
passenger_nodejs /home/user/wrappers/node;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.