在Debian 11(Debian bullseye)中安装最新版本的Nginx

在Debian 11(Debian bullseye)中安装最新版本的Nginx


发布日期: 2022-10-22 更新日期: 2022-10-22 编辑:bukun 浏览次数: 3266

标签:

摘要: 部署应用的服务器是Debian 11(代号为bullseye)。Debian服务坚如磐石,一直稳定地服务支持。但是有弱智的安全扫描程序,检测出其Nginx版本为1.80.x,但认为其有安全漏洞:CVE-2021-23017。 其实在Debian 11中,其Ng...

部署应用的服务器是Debian 11(代号为bullseye)。Debian服务坚如磐石,一直稳定地服务支持。但是有弱智的安全扫描程序,检测出其Nginx版本为1.80.x,但认为其有安全漏洞:CVE-2021-23017。

其实在Debian 11中,其Nginx版本为 1.18.0-6.1+deb11u2 。另外,关于这个漏洞,可参考: https://security-tracker.debian.org/tracker/CVE-2021-23017

信息如下:

Vulnerable and fixed packages

The table below lists information on source packages.

Source PackageReleaseVersionStatus
nginx (PTS)buster, buster (security)1.14.2-2+deb10u4fixed
bullseye1.18.0-6.1+deb11u2fixed
bookworm, sid1.22.0-3.1fixed

无奈被三番五次要求升级Nginx。道理讲不通只能进行处理了,记录过程如下:

第一步,添加nginx官方仓库:

echo "deb http://nginx.org/packages/debian/ bullseye nginx">> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/debian/ bullseye nginx">> /etc/apt/sources.list
wget http://nginx.org/keys/nginx_signing.key && apt-key add nginx_signing.key

第二步,进行更新:

apt update && apt dist-upgrade -y

注意Nignx不能被自动更新,需要运行下面命令:

apt dist-upgrade -y nginx

如果原本没安装的话,使用下面的命令:

apt install -y nginx

还要注意,这样安装的Nginx版本较新,其配置文件的要求与原来不一样。查看配置文件:

root@debian-69-wdc:~# more /etc/nginx/nginx.conf

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

注意上面倒数第二行中对于自定义Nginx配件文件的要求。我原来放到 site-enable 中,后缀为 .nginx ,刚升级完没法访问系统。

相关推荐

关注公众号
获取免费资源

随机推荐


Copyright © Since 2014. 开源地理空间基金会中文分会 吉ICP备05002032号

Powered by TorCMS

OSGeo 中国中心 邮件列表

问题讨论 : 要订阅或者退订列表,请点击 订阅

发言 : 请写信给: osgeo-china@lists.osgeo.org