部署vue项目可以利用tomcat服务器,也可以用户nginx部署。
如果利用nginx部署vue项目,则在linux上不需要配置node.js环境,启动nginx就可以,注意:跨域处理
一、 先有你的前端人员进行vue打包,会生成dist 文件
二、下载nginx
nginx配置文件进行修改
以下是我的配置文件内容:
upstream tomcatserver {
server 172.18.74.112:80 ;
server 47.92.215.252:8080 ;
}
server {
listen 80;
server_name 域名;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/default;
index index.html index.htm index.jsp;
#error_page 404 /404.html;
#error_page 502 /502.html;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .(jsp|jspx