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, //是否跨域
}
}
},
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
2、nginx配置
server {
listen 80;
server_name www.xxx.com;
return 307 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name www.xxx.com;
root html;
index index.html index.htm;
ssl_certificate /etc/cert/www.xxx.com.pem;
ssl_certificate_key /etc/cert/www.xxx.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 /xx {
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;
}
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.