云服务器配置部署前端项目实践

从零搭建前端项目运行环境

  1. 登录服务器

  2. 安装node
    下载Node.js安装包

    1
    2
    cd /usr/local/src/
    wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz

解压文件

1
tar xvf node-v10.15.3-linux-x64.tar.xz

创建软链接

1
2
ln -s /home/node-v10.15.3-linux-x64.tar.xz/bin/node /usr/local/bin/node
ln -s /home/node-v10.15.3-linux-x64.tar.xz/bin/npm /usr/local/bin/npm

验证

1
node -v

  1. 安装nginx

安装nginx相关的依赖

1
2

yum -y install gcc pcre-devel zlib-devel openssl openssl-devel

安装nginx相关的依赖

1
2
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.16.0.tar.gz

解压文件

1
tar -zxvf zlib-1.16.0.tar.gz

编译

1
2
3
4
//进入nginx
cd nginx-1.16.0
./configure
make install

启动

1
2
cd /usr/local/nginx/sbin/
./nginx

配置环境变量

1
2


4.

You forgot to set the qrcode for Alipay. Please set it in _config.yml.
You forgot to set the qrcode for Wechat. Please set it in _config.yml.
You forgot to set the business and currency_code for Paypal. Please set it in _config.yml.
You forgot to set the url Patreon. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×