![双重 Nginx 安装问题](https://linux22.com/image/788890/%E5%8F%8C%E9%87%8D%20Nginx%20%E5%AE%89%E8%A3%85%E9%97%AE%E9%A2%98.png)
似乎我在一台服务器上安装了两个 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 没有包信息,所以我猜可能是从源代码安装的?我该如何摆脱它?