CentOS 7.4源码编译nginx1.12 并且隐藏nginx的版本
2017-12-26 21:59
561 查看
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
解释--with-http_gzip_static_module :支持压缩--with-http_stub_status_module :支持nginx状态查询--with-http_ssl_module :支持https--with-http_spdy_module :支持google的spdy,想了解请百度spdy,这个必须有ssl的支持--with-pcre :为了支持rewrite重写功能,必须制定pcre可根据自己需求4. [root@localhost src]# make && make install
echo $? 意思为上一步的执行结果 0意思成功
5.添加系统变量(方便启停服务)
[root@localhost nginx-1.12.2]# vim /etc/profile 我一般是在56行添加 export PATH=/usr/local/nginx/sbin:$PATH
[root@localhost nginx-1.12.2]#source /etc/profile添加到系统路径就可以直接用了 [root@localhost nginx-1.12.2]# nginx -V
隐藏后的在服务器看
会显示编译时的详细信息 就可以直接操作启动 停止了
[root@localhost nginx-1.12.2]# nginx -s reload
[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
解释--with-http_gzip_static_module :支持压缩--with-http_stub_status_module :支持nginx状态查询--with-http_ssl_module :支持https--with-http_spdy_module :支持google的spdy,想了解请百度spdy,这个必须有ssl的支持--with-pcre :为了支持rewrite重写功能,必须制定pcre可根据自己需求4. [root@localhost src]# make && make install
echo $? 意思为上一步的执行结果 0意思成功
5.添加系统变量(方便启停服务)
[root@localhost nginx-1.12.2]# vim /etc/profile 我一般是在56行添加 export PATH=/usr/local/nginx/sbin:$PATH
[root@localhost nginx-1.12.2]#source /etc/profile添加到系统路径就可以直接用了 [root@localhost nginx-1.12.2]# nginx -V
隐藏后的在服务器看
会显示编译时的详细信息 就可以直接操作启动 停止了
[root@localhost nginx-1.12.2]# nginx -s reload
相关文章推荐
- RHEL/CentOS 7 系统上源码编译安装nginx,并隐藏替换nginx名称
- centos7.4搭建lnmp ###编译安装 nginx1.12 php7.2 ###
- RHEL/CentOS服务器上源码编译安装nginx
- LNMP源码编译过程 CentOS-7.3+Nginx-1.11+MySQL-5.7+php-7.1
- CentOS 7.4 使用源码包编译安装MySQL 5.7.20
- CentOS-6.4 源码包编译安装LNMP +Discuz开源论坛(mysql-5.6.14 +PHP-5.4.21+nginx-1.4.2)
- Centos6.5源码编译安装nginx
- Centos+Nginx+PHP7.0编译安装(和PHP5.6老版本共存)
- linux7下centos6.8版本完全编译php7.17与nginx --后续,配置nginx.conf与php-fpm.conf,www.conf
- centos7.2 源码编译安装nginx,实现tcp反向代理,不中断服务新增编译模块
- Centos6.3 编译源码搭建 PHP(fast-cgi)+Nginx+Mysql+Memcached+Redis高性能服务器
- CentOS源码编译安装Nginx
- centos7.4源码安装cacti仙人掌1.1.26版本
- Linux(CentOS) - 源码编译安装Nginx
- CentOS7 平台 源码编译安装Heartbeat,并实现nginx的HA集群
- CentOS 7.4 使用源码包编译安装MySQL 5.7.20
- CentOS源码编译更换gcc版本
- CentOS6.3源码编译安装nginx
- Centos6.6源码编译Nginx
- CentOS源码编译安装Nginx和tcp_proxy module