用 本地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; } } #開發環境