Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

centos 配置node环境 #10

Open
Yang03 opened this issue Aug 19, 2016 · 0 comments
Open

centos 配置node环境 #10

Yang03 opened this issue Aug 19, 2016 · 0 comments

Comments

@Yang03
Copy link
Owner

Yang03 commented Aug 19, 2016

安装node

安装nginx

  • vim /etc/yum.repos.d/nginx.repo
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=0
    enabled=1
  • yum clean
  • yum makecache
  • yum install nginx
    //conf 文件 在etc文件下 nginx -t

安装git 添加key

  • ssh-keygen
  • cat .pub

mac 安装mongo

curl -O https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.2.9.tgz
tar -zxvf mongodb-osx-x86_64-3.2.9.tgz
mkdir -p mongodb
cp -R -n mongodb-osx-x86_64-3.2.9/ mongodb
//export PATH=<mongodb-install-directory>/bin:$PATH
mkdir -p /data/db
cd mongodb/bin
mongod
mongo

wechatimg4

etc/mongo.conf
port: 20000
bindIp: 0.0.0.0

/etc/init.d/mongod start

/etc/init.d/mongo restart

netstat -anp |grep mongo

ps –ef | grep mongo

upstream my_nodejs_upstream {
    server 127.0.0.1:3000;
    keepalive 64;

}

server {
    listen       80;
    listen        443 ssl;
    server_name  driver.lol;
    ssl_certificate /home/ssl/1_driver.lol_bundle.crt;
    ssl_certificate_key /home/ssl/driver.lol.key;
    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_max_temp_file_size 0;
        proxy_pass http://my_nodejs_upstream/;
        proxy_redirect off;
        proxy_read_timeout 240s;
    }
     gzip on;
        gzip_comp_level 4;
        gzip_types    text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
        gzip_vary off;
        gzip_disable "MSIE [1-6]";
        gzip_min_length 66;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant