1、启动nginx
cd usr/local/nginx/sbin
./nginx
2、找到nginx安装目录
whereis nginx
cd usr/local/nginx/
3、打开nginx 配置文件
cd conf/
vi nginx.conf 按i 修改,新增配置
location /api {
proxy_set_header Host $host;
proxy_set_header x-forwarded-for $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://XXX.XX.XX.XXX:XXXX; // 接口地址
}