1.找到寶塔的nginx配置文件
寶塔有一點不同,nginx配置文件不在nginx的安裝目錄中,應當去/www/server/panel/vhost/nginx找到
2.添加你要跨域的地址
location /api {proxy_pass http://localhost:8080;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_set_header X-Forwarded-Proto $scheme;rewrite ^/api/(.*)$ /$1 break;
}