不积跬步,何以至千里

导航

Debian 安装 Nginx

安敷依赖包:
apt install curl gnupg2 ca-certificates lsb-release debian-archive-keyring

 

导入nginx 签名密钥:

curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null

验证密钥:
gpg --dry-run --quiet --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg
pub   rsa2048 2011-08-19 [SC] [expires: 2024-06-14]
      573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
uid                      nginx signing key <signing-key@nginx.com>

 

更新仓库文件:

echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/debian `lsb_release -cs` nginx"    | tee /etc/apt/sources.list.d/nginx.list

固定存储库,以使我们的软件包优于发行版提供的软件包:
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" | tee /etc/apt/preferences.d/99nginx
 
开始安装:
apt update
apt install nginx
Preparing to unpack .../nginx_1.20.2-1~bullseye_amd64.deb ...
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* https://nginx.org/en/docs/

Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* https://nginx.org/en/support.html

Commercial subscriptions for nginx are available on:.................................................................................] 
* https://nginx.com/products/

----------------------------------------------------------------------
Unpacking nginx (1.20.2-1~bullseye) ...
Setting up nginx (1.20.2-1~bullseye) ...########################.....................................................................] 
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service........................] 
Processing triggers for man-db (2.9.4-2) ...##################################################################.......................]

安装后缺省不运行,可通过以下命令使其运行:
systemctl start nginx

查看状态:
systemctl status nginx

● nginx.service - nginx - high performance web server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-04-30 20:55:16 CST; 2s ago
       Docs: https://nginx.org/en/docs/
    Process: 18059 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
   Main PID: 18060 (nginx)
      Tasks: 2 (limit: 2242)
     Memory: 1.7M
        CPU: 6ms
     CGroup: /system.slice/nginx.service
             ├─18060 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
             └─18061 nginx: worker process

Apr 30 20:55:16 iZrv8fu4iejmpkZ systemd[1]: Starting nginx - high performance web server...
Apr 30 20:55:16 iZrv8fu4iejmpkZ systemd[1]: nginx.service: Can't open PID file /run/nginx.pid (yet?) after start: Operation not permitted
Apr 30 20:55:16 iZrv8fu4iejmpkZ systemd[1]: Started nginx - high performance web server.

 

查看版本和配置:
nginx -V

nginx version: nginx/1.20.2
built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
built with OpenSSL 1.1.1k  25 Mar 2021 (running with OpenSSL 1.1.1n  15 Mar 2022)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -ffile-prefix-map=/data/builder/debuild/nginx-1.20.2/debian/debuild-base/nginx-1.20.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

 

posted on 2022-04-30 21:22  环保发动机  阅读(1047)  评论(0编辑  收藏  举报