apache2 服务器未启动

apache2 服务器未启动

每次我启动服务器时都会出现这个错误...

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Tue 2019-12-24 23:55:49 IST; 10ms ago
  Process: 11423 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
 Main PID: 2154 (code=exited, status=0/SUCCESS)

Dec 24 23:55:49 shantanu apachectl[11423]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 2401:4900:30e5:3307:2136:8a60:4eeb:ba13. Set the 'ServerName' directive globally to suppress this message
Dec 24 23:55:49 shantanu apachectl[11423]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Dec 24 23:55:49 shantanu apachectl[11423]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Dec 24 23:55:49 shantanu apachectl[11423]: no listening sockets available, shutting down
Dec 24 23:55:49 shantanu apachectl[11423]: AH00015: Unable to open logs
Dec 24 23:55:49 shantanu apachectl[11423]: Action 'start' failed.
Dec 24 23:55:49 shantanu apachectl[11423]: The Apache error log may have more information.
Dec 24 23:55:49 shantanu systemd[1]: apache2.service: Control process exited, code=exited status=1

输出:sudo netstat -ltnp | grep ':80'

tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      14946/unicorn maste 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      7251/nginx: worker  
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      3354/sidekiq 5.2.7  
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      7251/nginx: worker  

答案1

为了解决这个问题,我执行了一些命令:

sudo netstat -ltnp | grep ':80'

tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      23306/unicorn maste 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      23331/nginx: master 
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      3354/sidekiq 5.2.7  
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      23331/nginx: master

然后根据pid搜索程序:

sudo pwdx 23331

23331: /var/opt/gitlab/nginx

然后我发现 gitlab 程序有内部 nginx 服务所以我阻止了他们的 gitlab 程序

sudo gitlab-ctl stop

相关内容