nginx添加自定义header

nginx.conf,如下:

 


 

 

其中  Access-Control-Allow-Origin 是header 名字 "." 是对应的value

server {
listen 80 default_server;
add_header   Access-Control-Allow-Origin   '*' ; 
listen [::]:80 default_server;

root /root/mnt/bimatrix_fs;

index index.html index.htm index.nginx-debian.html;

server_name localhost;

location / {
add_header  Access-Control-Allow-Origin '*' ; 
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

}

nginx添加自定义header_第1张图片

你可能感兴趣的:(nginx)