- 语法
Syntax: add_header name value [always];Default: --Context:http,server,location,if in location
-
例:/etc/nginx/conf.d/default.conf
server { listen 80; server_name localhost; sendfile on; #charset koi8-r; #access_log /var/log/nginx/log/static_access.log main; location ~ .*\.(htm|html)$ { add_header Access-Control-Allow-Origin *; # *是允许所有,也可指定 add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE; root /opt/app/code; }... ...