1.下载
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget http://nginx.org/download/nginx-1.12.2.tar.gz
2.解压
[root@localhost src]# tar zxvf nginx-1.12.2.tar.gz
3. 预编译
安装前确认安装扩展 没有的直接 yum install wget gcc gcc-c++ pcre-devel zlib-devel openssl openssl-devel
如果要隐藏nginx的版本可以
(1).修改 nginx-1.12.2/src/core/nginx.h 文件
(2)src/http下的ngx_http_header_filter_module.c文件
vim src/http/ngx_http_header_filter_module.c
(3) src/http下的ngx_http_special_response.c文件
然后编译 nginx伪装成SSI
[root@localhost src]# cd nginx-1.12.2
[root@localhost nginx-1.12.2]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-pcre --with-http_gzip_static_module
echo $? 意思为上一步的执行结果 0意思成功
5.添加系统变量(方便启停服务)
隐藏后的在服务器看
会显示编译时的详细信息 就可以直接操作启动 停止了
[root@localhost nginx-1.12.2]# nginx -s reload