1、vue3配置
publicPath: "",
productionSourceMap: false,
lintOnSave: false, // 修改成false 就是eslint不检查了
devServer: {
historyApiFallback: true,
allowedHosts: 'all',
open: true,
host: '0.0.0.0',
port: 6060,
client: {
overlay: false, //关闭overlay讨厌的弹框
webSocketURL: 'ws://0.0.0.0/ws',//解决nginx代理使用https域名跳转出问题
},
proxy: {
'/api': { // '/api'是代理标识,用于告诉node,url前面是/api的就是使用代理的
pathRewrite: {
"^/api": "/" //这里理解成用'/api'代替target里面的地址,比如我要调用'http://40.00.100.100:3002/user/add',直接写'/api/user/add'即可
},
target: "http://localhost:9081/dyt", //目标地址,一般是指后台服务器地址
changeOrigin: true, //是否跨域
}
}
},
2、nginx配置
server {
listen 80;
server_name www.yxtblog.com;
return 307 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name www.yxtblog.com;
root html;
index index.html index.htm;
ssl_certificate /etc/cert/www.yxtblog.com.pem;
ssl_certificate_key /etc/cert/www.yxtblog.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_session_cache shared:SSL:50m;
ssl_protocols SSLv3 SSLv2 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
# root /data/dyt/web;
# index index.html index.htm;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.3.200:6060/; #advert-xcx管理页面地址
# proxy_pass http://192.168.3.200:8080/;
}
location /dyt {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.3.200:9081/dyt;
}
location /wss {
proxy_pass http://192.168.3.200:6060; #通过配置端口指向部署websocker的项目
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /ws {
proxy_pass http://192.168.3.200:6060; #通过配置端口指向部署websocker的项目
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
专注JAVA系统优化、系统结构调整、系统问题排查医治、系统升级、架构设计、SQL语句优化、小程序、APP、企业应用软件开发,请 + hekf888,欢迎关注,时常发布技术分享博文