前端要在本地测试ajax接口,无法跨域访问,所以在测试环境的nginx配置了跨域支持,方法如下: 在nginx.conf文件, http块下配置 42 #support cross domain access 43 add_header Access-Control-Allow-Origin *; 44 add_header Access-Control-Allow-Headers X-Requested-With; 45 add_header Access-Control-Allow-Meth…