修改配置文件
可通過如下配制進行多域名的設置。
map $http_origin $corsHost {
default 0;
"~https://www.itbiancheng.com" https://www.itbiancheng.com;
"~http://love.itbiancheng.com" http://love.itbiancheng.com;
}
server
{
listen 80;
server_name www.itbiancheng.com;
root /nginx;
location /
{
add_header Access-Control-Allow-Origin $corsHost;
}
}