Nginx配置Q&A
隐藏响应头
How can remove Nginx from http response header? - Stack Overflow
more_set_headers 'Server: my-server';
more_clear_headers 'Server';
http 到 https
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
隐藏fastcgi响应头
fastcgi_hide_header X-Powered-By;
隐藏nginx版本
server_tokens off;
添加额外响应头
add_header X-Frame-Options SAMEORIGIN;