yum install epel-release yun install nodejs
固然你也能够下载Node.js的源码包,经过./configure & make & make install 来安装。html
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
若是你的系统不是Centos7怎么办?node
到这里本身找:http://nginx.org/packages/nginx
yum install nginx
凡事先备份,当心驶得万年船啊!shell
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak mkdir /etc/nginx/sites-avaiable mkdir /ect/nginx/sites-enabled
在 http { } 块的末尾加上下面两行:(即在在 } 的前面添加)centos
include /etc/nginx/sites-enabled/*.conf; server_names_hash_bucket_size 64;
cp /etc/nginx/conf.d/default.conf /etc/nginx/sites-available/gso8.com.conf cp /etc/nginx/conf.d/default.conf /etc/nginx/sites-available/gso9.com.conf
eg:gso8.com.conf的配置以下,将对gso8.com的访问转发到本机的8008端口
浏览器
server { listen 80; server_name gso8.com www.gso8.com; location / { proxy_pass http://localhost:8008; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
这样作的好处是,能够灵活关闭部分站点
网站
ln -s /etc/nginx/sites-available/gso8.com.conf /etc/nginx/sites-enabled/gso8.com.conf ln -s /etc/nginx/sites-available/gso9.com.conf /etc/nginx/sites-enabled/gso9.com.conf
systemctl restart nginx
或者也能够 service nginx restartspa
若是遇到错误: nginx -t -c /etc/nginx/nginx.conf 检查下配置文件是否正确rest
最后访问你的浏览器,看看网站是否正常!code
最后,给咱的www.gso8.com的站点打个小广告,各位须要用谷歌搜索的同窗不妨访问试试看。