Nginx reverse proxy solves cross-domain configuration problems

server {
    listen       80;
    server_name  localhost;

    -sharpcharset koi8-r;

    -sharpaccess_log  logs/host.access.log  main;

    location / {
        
       
        proxy_pass http://localhost:8080;
        
    }
    
    location /apis {
        
        rewrite /apis / break;
        proxy_pass http://mooc.com;
    }
}

the vue project runs on port 8080. I would conflict if I listen 8080 directly, so I transferred port 80 to 8080 and / apis to the real interface address. This interface reading is normal, but very slow, about a few minutes before the page will be displayed, direct access to 8080 is instant open, this is why? Is there something wrong with my profile

May.22,2021

change http://localhost:8080 to http://127.0.0.1:8080 try

Menu