用 本地pc的目录,请求192.168.3.246的接口,以/api为标识
运行命令:
启动 nginx -s start
重启 nginx -s relaod
停止 nginx -s stop
查看 nginx -t
使用:
1.在nginx安装目录下运行 ngins -t,查看状态
2.启动nginx,nginx -s start
3.在浏览器输入http://127.0.0.1/:8080
4.完成跨域代理
#开发环境 server { listen 8080; server_name localhost; client_max_body_size 3000M; location / { root D:\git\okodm-pc-v2.0; } location /api/ { proxy_set_header host '192.168.3.246'; proxy_pass http://192.168.3.246/api/; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } #开发环境