nginx部署前端项目

nginx

  • nginx地址:180.76.52.53
  • 位置:/usr/local/nginx/
  • 访问地址:180.76.52.53:80

启动

[root@bj-esbp-mid1 sbin]# ./nginx

查看进程

[root@bj-esbp-mid1 sbin]# ps -ef | grep nginx  
root     14982     1  0 14:13 ? 00:00:00 nginx: master process ./nginx nobody 14983 14982 0 14:13 ? 00:00:00 nginx: worker process root 14989 2421 0 14:16 pts/0 00:00:00 grep nginx
  • 1
  • 2
  • 3
  • 4

重启

./nginx -s reload
  • 1

前端发布

  • 1、npm run build

  • 2、把dist里的文件打包上传至服务器

项目部署结构:

/data/www/ESBP_WEB/dist
|—–index.html
|—–js
|—–css
|—–images
….

  • 3、配置nginx监听80端口:
    编辑 /usr/local/nginx/conf下面的nginx.conf文件:
    修改访问的默认文件位置:
location / {
            root   /data/www/ESBP_WEB/dist;
            index  index.html index.htm;
        }

猜你喜欢

转载自www.cnblogs.com/zhumiao/p/9091568.html