/usr/local/nginx/sbin/nginx -V #查看版本 nginx version: nginx/1.4.3 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-ld-opt='-ljemalloc' #注意这里的编译项 cd lnmp/src wget http://nginx.org/download/nginx-1.4.4.tar.gz tar xzf nginx-1.4.4.tar.gz cd nginx-1.4.4 ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-ld-opt='-ljemalloc' make //注意只make 不要make install mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx$(date +%m%d) #备份nginx原文件 cp objs/nginx /usr/local/nginx/sbin/nginx #复制编译make后的文件覆盖nginx原文件 /usr/local/nginx/sbin/nginx -t #检测nginx文件配置 kill -USR2 `cat /usr/local/nginx/logs/nginx.pid` #把nginx.pid改成nginx.pid.oldbin跟着启动新的nginx kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin` #退出旧的nignx