1.前端vue部署(linux+nginx)
第一步:修改vue.config.js中如图
.
第二步:
打包:npm run build:prod --report
修改nginx配置文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80; # 前台访问的端口
server_name 自己的服务器地址; # 域名或ip
location / { # 访问路径配置
root /usr/local/ruoyi/dist/;# 根目录
try_files $uri $uri/ /index.html;
index index.html index.htm; # 默认首页
}
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/; #后台地址
}
}
}