Created
February 2, 2015 08:12
-
-
Save suchasplus/62659cd0959bf9e6fd64 to your computer and use it in GitHub Desktop.
Nginx不同域名输出不同伺服器标识 via ngx_headers_more
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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