Nginx优化与防盗链

隐藏版本号

可以使用

curl -l http://192.168.10.102
#IP地址用自己的

来查看nginx版本。

隐藏nginx版本号有两个方法

修改主配置文件

vim /usr/local/nginx/conf/nginx.conf
打开以后找到
http {
 server_tokens off;
}

前面有#号删了就行

nginx -t

查看,看到

nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful
就说明没有报错。

现在在次访问就可以看到ninex的版本号就被隐藏了。

修改用户和组

编译nginx时指定用户和组,就是配置nginx时,在./configure后面跟上参数,如下

./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_gunzip_module --with-http_gzip_static_module \
--with-http_stub_status_module && make && make install

配置用户和组

修改nginx配置文件nginx指定用户与组

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值