nginx跨域配置
首先下载nginx文件包,下载地址为 http://nginx.org/;
然后以此打开,conf>nginx.conf;(用记事本或nodepad++打开)。配置server;配置好重启nginx即可
server {
        listen  8888;
        server_name  localhost;
        location / {
            root   ..\###\###\###; // 文件index.html所在的文件夹(相对路径)
            index  index.html index.htm;
            try_files $uri $uri/ /index.html =404; // 在History模式下必配置的。
        }
        location /apis/ { // 替代接口的字符串,在项目使用的。
            rewrite  ^.+apis/?(.*)$ /$1 break;
            include  uwsgi_params;
            proxy_pass   http://***.***.***.***:****;// 代理的接口地址
       }
    }
目前在项目里很多是使用nginx来解决跨域的
 
             
             
             
             
            