服务器环境部署meteor

服务器包含: nodejs、git、mongodb

  1. 安装meteor

    $ curl https://install.meteor.com/ | sh
    
  2. 安装demeteorizer

    $ npm install -g demeteorizer
    
  3. 安装pm2

    $ npm install -g pm2
    
  4. 在仓库根目录键入

    $ demeteorizer 
    

    打包(构建nodejs可用)代码

  5. $ cd .demeteorized/bundle/programs/server
    
  6. $ npm install
    
  7. 返回仓库根目录键入

    $ MONGO_URL=mongodb://localhost:27017/test PORT=80 ROOT_URL=http://localhost:80 pm2 start main.js
    

Node.js 管理:

参考 https://www.kancloud.cn/summer/nodejs-install/71975 安装最新版本(包含了npm,无需单独安装)

  1. 安装 nvm

    $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
    

    or Wget:

    $ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
    
  2. 使用nvm安装node

    $ nvm install 4.6.1
    
  3. 设置默认node版本

    $ nvm alias default v5.0.0
    

对于小于1024的端口, 需要sudo

$ meteor --port 80
Error: listen EACCES
$ sudo meteor --port 80

mupx setup 失败

$ mupx setup: sudo:no tty present and no askpass program specified

编辑 /etc/sudoers 增加行

Defaults visiblepw;

参考:http://blog.csdn.net/buptxx/article/details/8241997


Apache 反向代理设置:

ServerName localhost

<VirtualHost *:80>

ServerName www.pay4china2.com

ProxyRequests Off

<Proxy *>

    Order deny,allow

    Allow from all

</Proxy>

ProxyPass /groupchat http://www.pay4china.com:3000/groupchat max=20 ttl=120 retry=300 ProxyPassReverse /groupchat http://www.pay4china:3000/groupchat

</VirtualHost>

反向代理配置 Q&A

Q:

AH00526: Syntax error on line 30 of /etc/apache2/sites-enabled/000-default.conf:
Invalid command 'ProxyRequests', perhaps misspelled or defined by a module not included in the server configuration

A:

$ sudo a2enmod proxy
$ sudo /etc/init.d/apache2 restart

Q:

No protocol handler was valid for the URL /groupchat. If you are using a DSO version of mod_proxy, 
make sure the proxy submodules are included in the 	configuration using LoadModule.

A:

$ sudo a2enmod proxy_http