[root@test-ds-nginx ~]# nginx -v
nginx version: nginx/1.12.2
[root@test-ds-nginx ~]# nginx -V
nginx version: nginx/1.12.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --user=nginx --group=nginx --pid-path=/var/run/nginx/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/usr/local/nginx/temp/proxy --http-fastcgi-temp-path=/usr/local/nginx/temp/fcgi --lock-path=/var/run/nginx/nginx.lock --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_flv_module --with-debug
[root@test-ds-nginx ~]# cd /usr/src/
[root@test-ds-nginx src]# wget https://nginx.org/download/nginx-1.14.2.tar.gz
[root@test-ds-nginx src]# tar xf nginx-1.14.2.tar.gz
[root@test-ds-nginx src]# cd nginx-1.14.2
[root@test-ds-nginx nginx-1.14.2]# vim src/core/nginx.h
Line 14:
#define NGINX_VER "nginx/" NGINX_VERSION
修改为
#define NGINX_VER "Linux_Web_Server/" NGINX_VERSION /*modify this line*/
make install
,否则将覆盖安装![root@test-ds-nginx nginx-1.14.2]# ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --user=nginx --group=nginx --pid-path=/var/run/nginx/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/usr/local/nginx/temp/proxy --http-fastcgi-temp-path=/usr/local/nginx/temp/fcgi --lock-path=/var/run/nginx/nginx.lock --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_flv_module --with-debug
[root@test-ds-nginx nginx-1.14.2]# make -j4
[root@test-ds-nginx nginx-1.14.2]# service nginx stop
[root@test-ds-nginx nginx-1.14.2]# tar czvf /usr/local/nginx.bak.tar.gz /usr/local/nginx/
[root@test-ds-nginx nginx-1.14.2]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old #备份旧的Nginx执行程序
[root@test-ds-nginx nginx-1.14.2]# cp objs/nginx /usr/local/nginx/sbin/nginx
[root@test-ds-nginx nginx-1.14.2]# service nginx start
正在启动 nginx: [确定]
[root@test-ds-nginx nginx-1.14.2]# nginx -v
nginx version: Linux_Web_Server/1.14.2