my vue port is 8090 background port is 8080
it is first configured in the proxyTable of vue
"/ api": {
target: "http://localhost:8080",
changeOrigin: true,
pathRewrite: {
"^/api": "http://localhost:8080" //
}
},
API such as / api/system/troubles/login
Local can cross-domain normally
now I want to implement it with nginx
server {
listen 1111;
server_name localhost;
location ^~/api/ {
rewrite ^/api/(.*) /$1 break;
proxy_pass http://localhost:8080/;
}
}
listen write 8090 will report port occupation, casually write 1111 can not cross-domain report 404, or location error? How should I write