用 本地pc的目录,请求192.168.3.246的接口,以/api为标识html
运行命令:nginx
启动 nginx -s startgit
重启 nginx -s relaodapi
中止 nginx -s stop跨域
查看 nginx -t浏览器
使用:spa
1.在nginx安装目录下运行 ngins -t,查看状态代理
2.启动nginx,nginx -s startcode
3.在浏览器输入http://127.0.0.1/:8080server
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; } } #开发环境