看來我在一台伺服器上安裝了兩個Nginx,Nginx Amplify 報告了兩個安裝(參見螢幕截圖),其中一個當然沒有發送更新,有時重新啟動Nginx 時會失敗,抱怨連接埠80 和443 已在使用中,我我猜測是其他安裝開始以某種方式運行,此時我知道如何解決它的唯一方法是重新啟動伺服器,而不是主安裝再次運行。
伺服器運行的是 Ubuntu 18.04.6,我真的不知道如何確認這兩個安裝,我查看了內部,rc2.d
但只看到一個 Nginx 條目:
$ ls -l /etc/rc2.d
total 4
-rw-r--r-- 1 root root 677 Feb 5 2016 README
lrwxrwxrwx 1 root root 23 Jun 30 2020 S01amplify-agent -> ../init.d/amplify-agent
lrwxrwxrwx 1 root root 17 Oct 9 2018 S01mongodb -> ../init.d/mongodb
lrwxrwxrwx 1 root root 17 Oct 8 2018 S01rsyslog -> ../init.d/rsyslog
lrwxrwxrwx 1 root root 29 Jan 2 2019 S01unattended-upgrades -> ../init.d/unattended-upgrades
lrwxrwxrwx 1 root root 15 Oct 8 2018 S01uuidd -> ../init.d/uuidd
lrwxrwxrwx 1 root root 13 Oct 8 2018 S02atd -> ../init.d/atd
lrwxrwxrwx 1 root root 14 Nov 25 2020 S02atop -> ../init.d/atop
lrwxrwxrwx 1 root root 18 Jan 17 2020 S02collectd -> ../init.d/collectd
lrwxrwxrwx 1 root root 14 Oct 8 2018 S02cron -> ../init.d/cron
lrwxrwxrwx 1 root root 14 Oct 8 2018 S02dbus -> ../init.d/dbus
lrwxrwxrwx 1 root root 17 Oct 8 2018 S02ipmievd -> ../init.d/ipmievd
lrwxrwxrwx 1 root root 20 Oct 8 2018 S02irqbalance -> ../init.d/irqbalance
lrwxrwxrwx 1 root root 15 Oct 8 2018 S02mdadm -> ../init.d/mdadm
lrwxrwxrwx 1 root root 15 Oct 9 2018 S02nginx -> ../init.d/nginx
lrwxrwxrwx 1 root root 13 Mar 2 2020 S02ntp -> ../init.d/ntp
lrwxrwxrwx 1 root root 18 Oct 8 2018 S02openipmi -> ../init.d/openipmi
lrwxrwxrwx 1 root root 17 Jul 7 2020 S02postfix -> ../init.d/postfix
lrwxrwxrwx 1 root root 22 Sep 28 2020 S02redis-server -> ../init.d/redis-server
lrwxrwxrwx 1 root root 15 Oct 8 2018 S02rsync -> ../init.d/rsync
lrwxrwxrwx 1 root root 13 Oct 8 2018 S02ssh -> ../init.d/ssh
lrwxrwxrwx 1 root root 17 Oct 8 2018 S02sysstat -> ../init.d/sysstat
lrwxrwxrwx 1 root root 16 Jan 17 2020 S02xinetd -> ../init.d/xinetd
lrwxrwxrwx 1 root root 21 Oct 8 2018 S03grub-common -> ../init.d/grub-common
lrwxrwxrwx 1 root root 18 Oct 8 2018 S03ondemand -> ../init.d/ondemand
lrwxrwxrwx 1 root root 18 Oct 8 2018 S03plymouth -> ../init.d/plymouth
lrwxrwxrwx 1 root root 18 Oct 8 2018 S03rc.local -> ../init.d/rc.local
更多資訊:
$ which nginx
/usr/sbin/nginx
我怎麼能解決這個問題並刪除第二個安裝而不弄亂主要的安裝?
請注意,這是在生產伺服器上進行的,因此我無法完全清理 Nginx 軟體包並再次重新安裝。
編輯
我已經卸載了nginx-extras
(1.18)並安裝了nginx
(1.21),有一段時間它顯示了前兩個 1.18 安裝以及新的 1.21。今天我檢查了一下,只顯示一個 1.18 和一個 1.21。
查看 Amplify 內的更多詳細信息,這裡是有關兩個實例的資訊:
Nginx object
GENERAL
Version: nginx 1.18.0
Status: down
PROCESSES
Running master process: /usr/sbin/nginx
Master process started: 2 days 1 hr ago
Master process id: 2266
Packages:
CONFIGURATION
Running configuration: /etc/nginx/nginx.conf
Stub status URL: http://127.0.0.1:80/nginx_status
CONFIGURE ARGS
--with-http_realip_module=true
--with-stream_ssl_module=true
--with-http_v2_module=true
--with-http_sub_module=true
--with-http_auth_request_module=true
--with-http_slice_module=true
--with-pcre-jit=true
--prefix=/usr/share/nginx
--with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2'
--pid-path=/run/nginx.pid
--with-http_ssl_module=true
--http-log-path=/var/log/nginx/access.log
--with-http_gzip_static_module=true
--with-http_image_filter_module=true
--with-http_addition_module=true
--with-http_geoip_module=true
--with-http_dav_module=true
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--with-http_perl_module=true
--http-proxy-temp-path=/var/lib/nginx/proxy
--with-http_gunzip_module=true
--with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -fPIC'
--conf-path=/etc/nginx/nginx.conf
--add-module=/build/nginx-1.18.0/debian/modules/headers-more-nginx-module
--add-module=/build/nginx-1.18.0/debian/modules/nginx-auth-pam
--add-module=/build/nginx-1.18.0/debian/modules/nginx-cache-purge
--add-module=/build/nginx-1.18.0/debian/modules/nginx-dav-ext-module
--add-module=/build/nginx-1.18.0/debian/modules/nginx-development-kit
--add-module=/build/nginx-1.18.0/debian/modules/nginx-echo
--add-module=/build/nginx-1.18.0/debian/modules/ngx-fancyindex
--add-module=/build/nginx-1.18.0/debian/modules/nchan
--add-module=/build/nginx-1.18.0/debian/modules/nginx-lua
--add-module=/build/nginx-1.18.0/debian/modules/nginx-upload-progress
--add-module=/build/nginx-1.18.0/debian/modules/nginx-upstream-fair
--add-module=/build/nginx-1.18.0/debian/modules/ngx_http_substitutions_filter_module
--add-module=/build/nginx-1.18.0/debian/modules/passenger/src/nginx_module
--with-http_stub_status_module=true
--with-http_secure_link_module=true
--with-http_flv_module=true
--with-threads=true
--error-log-path=/var/log/nginx/error.log
--lock-path=/var/lock/nginx.lock
--with-http_mp4_module=true
--with-debug=true
--with-mail_ssl_module=true
--with-compat=true
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
--with-stream=true
--with-http_xslt_module=true
--with-mail=true
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-client-body-temp-path=/var/lib/nginx/body
--with-http_random_index_module=true
AGENT
Account id: 36413
Object type: nginx
Object id: 88921
Api key: 2c55b5b4e8f5187780843bfc8bef1903
Agent version: 1.7.0-1
Parent id: 88920
Nginx object
GENERAL
Version: nginx 1.21.0
Status: up
PROCESSES
Running master process: /usr/sbin/nginx
Master process started: 13 hrs ago
Master process id: 15937
Packages: nginx: 1.21.0-1~xenial
CONFIGURATION
Running configuration: /etc/nginx/nginx.conf
Stub status URL: http://127.0.0.1:80/nginx_status
CONFIGURE ARGS
--with-http_realip_module=true
--lock-path=/var/run/nginx.lock
--with-http_v2_module=true
--with-http_sub_module=true
--with-http_auth_request_module=true
--with-http_slice_module=true
--with-file-aio=true
--prefix=/etc/nginx
--pid-path=/var/run/nginx.pid
--with-http_ssl_module=true
--http-log-path=/var/log/nginx/access.log
--with-http_gzip_static_module=true
--with-http_addition_module=true
--with-http_dav_module=true
--group=nginx
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--with-stream_ssl_module=true
--modules-path=/usr/lib/nginx/modules
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--with-stream_ssl_preread_module=true
--sbin-path=/usr/sbin/nginx
--with-http_gunzip_module=true
--with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
--conf-path=/etc/nginx/nginx.conf
--with-http_stub_status_module=true
--with-http_secure_link_module=true
--with-http_flv_module=true
--with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC'
--error-log-path=/var/log/nginx/error.log
--user=nginx
--with-http_mp4_module=true
--with-threads=true
--with-mail_ssl_module=true
--with-compat=true
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--with-stream=true
--with-mail=true
--http-scgi-temp-path=/var/cache/nginx/scgi_temp
--http-client-body-temp-path=/var/cache/nginx/client_temp
--with-http_random_index_module=true
--with-stream_realip_module=true
AGENT
Account id: 36413
Object type: nginx
Object id: 115575
Api key: 2c55b5b4e8f5187780843bfc8bef1903
Agent version: 1.7.0-1
Parent id: 88920
相同的主進程,相同的配置文件,但 1.18 沒有軟體包信息,所以我猜測它可能是從源代碼安裝的?我該如何擺脫它?