server {
    listen       80;
    charset utf-8;
    keepalive_timeout  300;
    client_max_body_size   50m;
    server_name  pj-feedback.sany.com.cn;
    location / {
        root /data/html/**;	
		# 配置页面不缓存html和htm结尾的文件
		if ($request_filename ~* .*\.(?:htm|html)$) 
		{
			add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
		}
        index  index.html index.htm;
		
		# 配置支持跨域
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
        add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
        if ($request_method = 'OPTIONS') {
			return 204;
        }
     }
}
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐