安装 nginx 后,将其与 apache2 一起卸载,apache2 不再起作用

安装 nginx 后,将其与 apache2 一起卸载,apache2 不再起作用
  • sudo systemctl reload apache2

此错误的结果: apache2.service is not active, cannot reload.

  • systemctl restart apache2.service

此错误的结果: Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

  • sudo service --status-all | grep apache

结果如下:

 [ - ]  apache-htcacheclean
 [ - ]  apache2
  • system status apache2.service

    apache2.service - The Apache HTTP Server
    Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor pres>
    Active: failed (Result: exit-code) since Thu 2021-05-27 10:19:36 CEST; 2m>
    Docs: https://httpd.apache.org/docs/2.4/
    Process: 20030 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/>
    lines 1-5/5 (END)...skipping...
    
    ● apache2.service - The Apache HTTP Server
    Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Thu 2021-05-27 10:19:36 CEST; 2min 7s ago
    Docs: https://httpd.apache.org/docs/2.4/
    Process: 20030 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
    
    ● apache2.service - The Apache HTTP Server
    Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Thu 2021-05-27 10:19:36 CEST; 2min 7s ago
    Docs: https://httpd.apache.org/docs/2.4/
    Process: 20030 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
    
  • journalctl -xe

-- The job identifier is 579.
Maj 27 10:06:49 Marinario-Ubuntu systemd[2394]: gnome-launched-org.gnome.Term>
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit UNIT has successfully entered the 'dead' state.
Maj 27 10:07:00 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't o>
Maj 27 10:07:02 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't o>
Maj 27 10:11:23 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent>
Maj 27 10:15:19 Marinario-Ubuntu nautilus[12393]: Called "net usershare info">
Maj 27 10:15:33 Marinario-Ubuntu nautilus[12393]: Called "net usershare info">
Maj 27 10:15:47 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent>
Maj 27 10:15:50 Marinario-Ubuntu pkexec[19704]: pam_unix(polkit-1:session): s>
Maj 27 10:15:51 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=240>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=240>
Maj 27 10:15:58 Marinario-Ubuntu gedit[19725]: Loading metadata failed: The s>
Maj 27 10:15:58 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent>
Maj 27 10:19:33 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent>
lines 2234-2254/2254 (END)
-- 
-- The job identifier is 579.
Maj 27 10:06:49 Marinario-Ubuntu systemd[2394]: gnome-launched-org.gnome.Terminal.desktop-18859.scope: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit UNIT has successfully entered the 'dead' state.
Maj 27 10:07:00 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Maj 27 10:07:02 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Maj 27 10:11:23 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:19 Marinario-Ubuntu nautilus[12393]: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
Maj 27 10:15:33 Marinario-Ubuntu nautilus[12393]: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
Maj 27 10:15:47 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:50 Marinario-Ubuntu pkexec[19704]: pam_unix(polkit-1:session): session opened for user root by (uid=1001)
Maj 27 10:15:51 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=2409] Activating service name='org.gnome.gedit' requested by ':1.174' (uid=1001 pid=12393 comm="/usr/bin/nautilus --gapplication-servi>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=2409] Successfully activated service 'org.gnome.gedit'
Maj 27 10:15:58 Marinario-Ubuntu gedit[19725]: Loading metadata failed: The specified location is not mounted
Maj 27 10:15:58 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:19:33 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.

~
lines 2234-2254/2254 (END)
-- 
-- The job identifier is 579.
Maj 27 10:06:49 Marinario-Ubuntu systemd[2394]: gnome-launched-org.gnome.Terminal.desktop-18859.scope: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit UNIT has successfully entered the 'dead' state.
Maj 27 10:07:00 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Maj 27 10:07:02 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Maj 27 10:11:23 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:19 Marinario-Ubuntu nautilus[12393]: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
Maj 27 10:15:33 Marinario-Ubuntu nautilus[12393]: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
Maj 27 10:15:47 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:50 Marinario-Ubuntu pkexec[19704]: pam_unix(polkit-1:session): session opened for user root by (uid=1001)
Maj 27 10:15:51 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=2409] Activating service name='org.gnome.gedit' requested by ':1.174' (uid=1001 pid=12393 comm="/usr/bin/nautilus --gapplication>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=2409] Successfully activated service 'org.gnome.gedit'
Maj 27 10:15:58 Marinario-Ubuntu gedit[19725]: Loading metadata failed: The specified location is not mounted
Maj 27 10:15:58 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:19:33 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
~~
~
lines 2234-2254/2254 (END)
-- 
-- The job identifier is 579.
Maj 27 10:06:49 Marinario-Ubuntu systemd[2394]: gnome-launched-org.gnom>
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit UNIT has successfully entered the 'dead' state.
Maj 27 10:07:00 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Coul>
Maj 27 10:07:02 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Coul>
Maj 27 10:11:23 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticatio>
Maj 27 10:15:19 Marinario-Ubuntu nautilus[12393]: Called "net usershare>
Maj 27 10:15:33 Marinario-Ubuntu nautilus[12393]: Called "net usershare>
Maj 27 10:15:47 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticatio>
Maj 27 10:15:50 Marinario-Ubuntu pkexec[19704]: pam_unix(polkit-1:sessi>
Maj 27 10:15:51 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticatio>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 p>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 p>
lines 2234-2251/2254 100%
-- 
-- The job identifier is 579.
Maj 27 10:06:49 Marinario-Ubuntu systemd[2394]: gnome-launched-org.gnome.Ter>
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit UNIT has successfully entered the 'dead' state.
Maj 27 10:07:00 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't >
Maj 27 10:07:02 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't >
Maj 27 10:11:23 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgen>
Maj 27 10:15:19 Marinario-Ubuntu nautilus[12393]: Called "net usershare info>
Maj 27 10:15:33 Marinario-Ubuntu nautilus[12393]: Called "net usershare info>
Maj 27 10:15:47 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgen>
Maj 27 10:15:50 Marinario-Ubuntu pkexec[19704]: pam_unix(polkit-1:session): >
Maj 27 10:15:51 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgen>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=24>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=24>
Maj 27 10:15:58 Marinario-Ubuntu gedit[19725]: Loading metadata failed: The >
Maj 27 10:15:58 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgen>
lines 2234-2253/2254 100%
-- 
-- The job identifier is 579.
Maj 27 10:06:49 Marinario-Ubuntu systemd[2394]: gnome-launched-org.gnome.Terminal.desktop-18859.scope: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit UNIT has successfully entered the 'dead' state.
Maj 27 10:07:00 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Maj 27 10:07:02 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Maj 27 10:11:23 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:19 Marinario-Ubuntu nautilus[12393]: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
Maj 27 10:15:33 Marinario-Ubuntu nautilus[12393]: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
Maj 27 10:15:47 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:50 Marinario-Ubuntu pkexec[19704]: pam_unix(polkit-1:session): session opened for user root by (uid=1001)
Maj 27 10:15:51 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=2409] Activating service name='org.gnome.gedit' requested by ':1.174' (uid=1001 pid=12393 comm="/usr/bin/nautilus --gapplication-servi>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=2409] Successfully activated service 'org.gnome.gedit'
Maj 27 10:15:58 Marinario-Ubuntu gedit[19725]: Loading metadata failed: The specified location is not mounted
Maj 27 10:15:58 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:19:33 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
~

lines 2234-2254/2254 (END)
-- 
-- The job identifier is 579.
Maj 27 10:06:49 Marinario-Ubuntu systemd[2394]: gnome-launched-org.gnome.Terminal.desktop-18859.scope: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit UNIT has successfully entered the 'dead' state.
Maj 27 10:07:00 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Maj 27 10:07:02 Marinario-Ubuntu sudo[18914]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Maj 27 10:11:23 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:19 Marinario-Ubuntu nautilus[12393]: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
Maj 27 10:15:33 Marinario-Ubuntu nautilus[12393]: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
Maj 27 10:15:47 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:50 Marinario-Ubuntu pkexec[19704]: pam_unix(polkit-1:session): session opened for user root by (uid=1001)
Maj 27 10:15:51 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=2409] Activating service name='org.gnome.gedit' requested by ':1.174' (uid=1001 pid=12393 comm="/usr/bin/nautilus --gapplication>
Maj 27 10:15:57 Marinario-Ubuntu dbus-daemon[2409]: [session uid=1001 pid=2409] Successfully activated service 'org.gnome.gedit'
Maj 27 10:15:58 Marinario-Ubuntu gedit[19725]: Loading metadata failed: The specified location is not mounted
Maj 27 10:15:58 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
Maj 27 10:19:33 Marinario-Ubuntu gnome-shell[2641]: polkitAuthenticationAgent: Received 2identities that can be used for authentication. Only considering one.
~

有人能帮助我吗?谢谢!

答案1

我去检查了端口 80 上是否有其他服务/服务器在运行:

sudo netstat -tulpn | grep :80

对我来说,情况确实lighttpd如此,所以我必须停止它sudo service lighttpd stop

然后我启动了 apache2,sudo service apache2 start没有任何问题。

这就是我做到的方法!

相关内容