下载
http://nginx.org/en/download.html
安装依赖
yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
debian安装pcre,zlib依赖:
apt-get install libpcre3 libpcre3-dev
apt-get install zlib1g
apt-get install zlib1g.dev
添加www用户
#添加www 用户
groupadd -f www
useradd -g www www
配置
./configure --prefix=/root/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream --with-http_gzip_static_module --with-http_sub_module --with-ipv6
编译&安装
make && make install
隐藏nginx版本号
进入nginx配置文件的目录,编辑nginx.conf文件在http {—}里加上
server_tokens off;
这样就对外隐藏了nginx版本号了,就是出现404、501等页面也不会显示nginx版本。
文章评论