[root@linuxprobe ~]# wget http://nginx.org/download/nginx-1.10.1.tar.gz[root@linuxprobe ~]# tar xvf nginx-1.10.1.tar.gz -C /usr/local/src/[root@linuxprobe ~]# cd /usr/local/src/nginx-1.10.1/
[root@linuxprobe nginx-1.10.1]# curl -I http://www.baidu.com…… Server: bfe/1.0.8.14 …… [root@linuxprobe nginx-1.10.1]# curl -I http://www.sina.com.cn…… Server: nginx …… [root@linuxprobe nginx-1.10.1]# curl -I https://www.linuxprobe.comHTTP/1.1 200 OK Server: nginx/1.10.1 #我们目标是将nginx更改名字Content-Type: text/html; charset=UTF-8 Connection: keep-alive X-Powered-By: PHP/5.6.29 Set-Cookie: PHPSESSID=smm0i6u4f9v7bj0gove79ja1g7; path=/ Cache-Control: no-cache Date: Mon, 07 Seq 2016 06:09:11 GMT [root@linuxprobe nginx-1.10.1]# vim src/core/nginx.h
#define nginx_version “nginx_stable” #此行修改的是你想要的版本号
#define NGINX_VER “linuxprobe/” NGINX_VERSION #此行修改的是你想修改的软件名称
[root@linuxprobe nginx-1.10.1]# vim +49 src/http/ngx_http_header_filter_module.c
拓展:通用http头域
通用头域包含请求和响应消息都支持的头域,通用头域包含Cache-Control、 Connection、Date、Pragma、Transfer-Encoding、Upgrade、Via。如果通用头域被扩展,双方都需要支持此扩展。如果存在不支持的通用头域,一般会当作实体头域来处理。一些设备或软件能够获取连接信息,而另一些则不能,如果要完全隐藏,就必须做全面的保密
static char ngx_http_server_string[] = “Server: LinuxprobeWeb” CRLF;
[root@linuxprobe nginx-1.10.1]# vim +29 src/http/ngx_http_special_response.c
有时候我们页面程序出现错误,Nginx会代我们返回相应的错误代码,回显的时候,会带上nginx和版本号,我们把他隐藏起来
static u_char ngx_http_error_full_tail[] ="" NGINX_VER "" CRLF"
以上就是怎么安装并调优Nginx的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号