首页 > Web开发 > 详细

nginx——网站显示问题

时间:2019-11-11 10:11:40      阅读:107      评论:0      收藏:0      [点我收藏+]

一般来说修改3个位置,一个是nginx.h、另一个是ngx_http_header_filter_module.c、还有一个ngx_http_special_response.c。

提示:一般修改都是在nginx编译之前修改,修改完了之后需要重新编译
cd scr/core/nginx.conf

#define NGINX_VERSION      "1.4.7"
#define NGINX_VER          "nginx/" NGINX_VERSION
改为
#define NGINX_VERSION      "1.4.7"
#define NGINX_VER          "jdws/" NGINX_VERSION

cd /src/http/ngx_http_header_filter_module.c (HTTP ResponseHeader)
static char ngx_http_server_string[] = "Server: nginx" CRLF;
修改为
static char ngx_http_server_string[] = "Server: jdws" CRLF;

vim /src/http/ngx_http_special_response.c 
static u_char ngx_http_error_tail[] =
"<hr><center>nginx</center>" CRLF
"</body>" CRLF
"</html>" CRLF
修改为

static u_char ngx_http_error_tail[] =
"<hr><center>jdws</center>" CRLF
"</body>" CRLF
"</html>" CRLF

除了随意修改版本号之外,还可以隐藏版本号:

修改nginx.conf

在http{}加入

http{
     server_tokens  off;  
}
就可以隐藏版本号了。
注意:

关掉了server_tokens之后,nginx.conf配置的东西会无效,回去寻找刚才我们第二步和第三步的配置

 

nginx——网站显示问题

原文:https://www.cnblogs.com/betterquan/p/11832799.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!