Articles of node.js

在Amazon Linux AMI上安装npm和supervisor包时遇到麻烦

我正在运行亚马逊Linux AMI,并通过wget源代码,成功安装node.js,解压缩文件,然后运行./configure ,然后使用sudo make install 。 当我安装npm时: curl http://npmjs.org/install.sh | sudo sh 它输出: npm cannot be installed without nodejs. Install node first, and then try again. Maybe node is installed, but not in the PATH? Note that running as sudo can change envs. PATH=/sbin:/bin:/usr/sbin:/usr/bin 但节点显然是安装的(运行node -v显示其版本),所以它必须是该节点不在我的path。 我打开~/.bash_profile并添加这一行: export PATH=/usr/local/bin:$PATH 然后运行source ~/.bash_profile 并尝试再次安装npm,只是发现它输出的是和上次一样的消息,完全一样的PATH。 然后,奇怪的是,我注意到,实际上安装npm! 运行npm -v显示其版本。 […]

EPEL存储库上的nodejs版本

目前稳定的node.js版本是v0.12.2 。 我只是在我的机器上运行yum update ,并将节点更新到v0.10.36 。 为什么我的EPEL回购版与现在的稳定版相比如此之旧? 我可以通过yum更新节点到最新版本,还是必须自己编译? 我有CentOS 6.6

使用nginx运行node.js应用程序

我有一个运行在端口8443上的节点应用程序。我的nginx处理端口80和443上的web请求,并将用户redirect到8443。 这里是我的/etc/nginx/sites-enabled/defaultconfiguration: upstream my_upstream { server 127.0.0.1:8443; keepalive 64; } server { listen 80; server_name myapp.com; rewrite ^/(.*) https://myapp.com/$1 permanent; } server { listen 443 ssl; server_name 12.34.12.34 www.myapp.com myapp.com *.myapp.com; ssl_certificate /path/to/my/cert.crt; ssl_certificate_key /path/to/my/private.key // other ssl params location / { proxy_redirect off; proxy_pass https://my_upstream; // other params } } 有了这个configuration我可以通过访问我的应用程序 http(s)://myapp.com:8443 只有当我添加下面的iptables iptables […]

我需要nodejs和mongodb每秒处理5000个请求

如标题所示,我需要nodejs和mongodb来处理每秒5000个请求。 马上就是蝙蝠 我们最终会成长很多次。 我最初的想法是把每个机器放在不同的机器上,但我不确定是否应该从小机器开始,准备很快地扩展,或者从较大的机器开始,然后扩展。 无论哪种方式,我完全期望最终扩大这两个,但我想知道高档触发器会是什么。 我会扩大CPU或内存使用量吗? 如果在CPU上,我应该尝试保持平均CPU使用率? 哦,是的,我会从10gen购买支持,以便他们可以审查我的文档模型,并确保我以最有效的方式存储数据。

安装和configurationdocular

我正在尝试在node.js平台上安装和configurationdoculare软件包。 我从官方文档网站grunt-docular.com开始 。 数百次尝试之后,运行grunt docular-server时出现问题。 我认为在docular包和它的grunt插件grunt-docular之间的兼容性问题。 当我试图使用[email protected][email protected]它的工作。 但目标是使用最新版本的npm软件包来获取angular度文档的最新版本。 错误是: Warning: Task "docular-server" not found. Use –force to continue. Aborted due to warnings. 这是我做的: npm install grunt-docular 这是我的gruntconfiguration文件: module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), docular: { groups: [], showDocularDocs: true, showAngularDocs: true } }); // Load the plugin that provides the "docular" […]

在服务器上的NodeJS中创build应用程序的最佳位置在哪里?

有一段时间我正在开发Nodejs的应用程序。 我问服务器上的Linux文件系统是什么地方让它运行的最好的地方。 由于PHP5和Apache2位于/var/www ,而tomcat有自己的系统。 我想知道最好的地方在哪里?

在Ubuntu上永远是nodejs +的简单新贵脚本

我正在使用Ubuntu Sever 12.04。 我有一个nodejs应用程序,我想这样运行: NODE_ENV=production PORT=3001 APP_PATH=/var/www/myapp forever -a -l /var/www/myapp/forever.log -o /var/www/myapp/out.log -e /var/www/myapp/err.log /var/www/myapp/app.js 我想在系统启动时运行它,并在系统closures时“永久停止”。 我读过,首选的方法是使用暴发户脚本。 这就是我所尝试的: description "Upstart script" start on startup stop on shutdown expect fork env MYAPP_PATH="/var/www/myapp" script NODE_ENV=production PORT=3001 APP_PATH=$MYAPP_PATH exec forever -a -l $MYAPP_PATH/forever.log -o $MYAPP_PATH/out.log -e $MYAPP_PATH/err.log $MYAPP_PATH/app.js end script pre-stop script exec forever stop $MYAPP_PATH/app.js >> […]

弹性beanstalk是否从package.json文件运行postinstall?

我正在使用弹性beanstalk来部署node.js应用程序。 在我的scripts部分package.json我有: "scripts": { "start": "node_modules/.bin/coffee server.coffee", "test": "NODE_ENV=test node test/runner.js", "coverage": "NODE_ENV=test COVERAGE=1 node test/runner.js -R html-cov test/ > ./test/coverage.html", "testw": "fswatch -o test src | xargs -n1 -I{} sh -c 'coffeelint src server.coffee ; npm test'", "db:drop": "node scripts/drop-tables.js", "encryptConfig": "node_modules/.bin/coffee config/encrypt.coffee", "decryptConfig": "node_modules/.bin/coffee config/decrypt.coffee", "postinstall": "npm run decryptConfig" }, npm install似乎工作。 但是postinstall不执行。 […]

在Varnish / Nginx服务器上部署node.js应用程序的最佳方式

我即将部署一个全新的node.js应用程序,我需要一些帮助来设置它。 我的设置现在的方式如下。 我已经在external_ip:80上运行了Varnish 我有Nginx在internal_ip:80上运行 两个都在80端口,一个内部端口,一个外部监听。 注意:node.js应用程序在WebSockets上运行 现在我有了我的新的node.js应用程序,它将在端口8080上侦听。 我可以清漆设置,它是在nginx和node.js前面。 Varnish必须将websocket代理到端口8080,但是静态文件(如css,js等)必须通过端口80到nignx。 Nginx不支持开箱即用的websockets,否则我会这样安装: 清漆 – > nignx – > node.js

生产中运行node.js服务器的事实标准是什么?

我应该如何守护进程和“看门狗”它,重新启动时自动启动,redirect控制台输出到日志文件?