ng
vue.config.js配置
module.exports = {
// 是否开启cssSourceMap
productionSourceMap: true,
//build输出目录
outputDir:"h5",
//静态资源目录(js, css, img)
assetsDir:"static",
filenameHashing:false,
// 设置打包文件路径
publicPath: process.env.NODE_ENV === 'production' ? '././' : '/',
devServer: {
// host:'192.168.1.16',
// port:8080,
proxy: {
"/server": {
//API服务器的地址
target: "http://127.0.0.1:8081/",
logLevel:'debug',
// 是否跨域,虚拟的站点需要更管origin
changeOrigin: true,
pathRewrite: {
//重写路径
"^/server": "/server"
}
},
},
},
}
nginx配置
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_names_hash_max_size 512;
server_names_hash_bucket_size 128;
server {
//访问端口
listen 7078;
//访问地址
server_name 127.0.0.1;
//前端配置路径
location / {
root D:/h5;
index index.html;
try_files $uri $uri/ @router;
}
//后端服务器请求地址
location ^~/prod-api-h5/{
proxy_pass http://127.0.0.1:8081/;
proxy_set_header Host $host:$server_port;
}
location @router {
rewrite ^.*$ /index.html last;
}
error_page 500 502 504 /50x.html;
location =/50x.html{
root html;
}
}
}