ruby-on-rails – 隐藏Passenger / Nginx服务器中的标头

我试图隐藏生产服务器的这个标头,但没有成功:X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.7X-Runtime: 0.021429Server: nginx/1.0.0 + Phusion Passenger 3.0.7 (mod_rails/mod_rack)使用:- Rails ...

我试图隐藏生产服务器的这个标头,但没有成功:

 X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.7
 X-Runtime: 0.021429
 Server: nginx/1.0.0 + Phusion Passenger 3.0.7 (mod_rails/mod_rack)

使用:

- Rails 3.0.9
- Passenger 3.0.7
- Nginx 1.0.0

有任何想法吗 ?

解决方法:

要删除nginx Server:标头,可以使用directive以上的server_tokens.

对于其他标题,请尝试使用Headers More nginx模块:

more_set_headers 'Server: anon'; # replace the default 'nginx + Passenger'
more_set_headers 'X-Powered-By'; # clear header entirely

本文标题为:ruby-on-rails – 隐藏Passenger / Nginx服务器中的标头