Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save suchasplus/62659cd0959bf9e6fd64 to your computer and use it in GitHub Desktop.
Save suchasplus/62659cd0959bf9e6fd64 to your computer and use it in GitHub Desktop.
Nginx不同域名输出不同伺服器标识 via ngx_headers_more
//ngx_headers_more
location / {
if ( $host = 'bp.biz.weibo.com' ){
more_set_headers 'Server: Nginx';
}
if ( $host = 'tui.weibo.com' ){
more_set_headers 'Server: Nginx_improved';
}
....
}
//or
map $host $server_x_tag{
'bp.biz.weibo.com' 'Nginx';
'tui.weibo.com' 'Nginx_improved';
default 'Nginx';
}
server{
server_name 123;
location / {
more_set_headers 'Server: $server_x_tag';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment