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的站點打個小廣告,各位須要用谷歌搜索的同窗不妨訪問試試看。