不要在ubuntu上重新启动apache2

不要在ubuntu上重新启动apache2,apache,ubuntu,Apache,Ubuntu,运行sudo service apache2重启后显示此错误: ● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2018-08-20 07:36:07 UTC; 18s ago Process: 27

运行sudo service apache2重启后显示此错误:

● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-08-20 07:36:07 UTC; 18s ago
Process: 27890 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Aug 20 07:36:07 debian apachectl[27890]: (98)Address already in use: AH00072: make_sock: could not bi
Aug 20 07:36:07 debian apachectl[27890]: (98)Address already in use: AH00072: make_sock: could not bi
Aug 20 07:36:07 debian apachectl[27890]: no listening sockets available, shutting down
Aug 20 07:36:07 debian apachectl[27890]: AH00015: Unable to open logs
Aug 20 07:36:07 debian apachectl[27890]: Action 'start' failed.
Aug 20 07:36:07 debian apachectl[27890]: The Apache error log may have more information.
Aug 20 07:36:07 debian systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 20 07:36:07 debian systemd[1]: Failed to start The Apache HTTP Server.
Aug 20 07:36:07 debian systemd[1]: apache2.service: Unit entered failed state.
Aug 20 07:36:07 debian systemd[1]: apache2.service: Failed with result 'exit-code'.
我使用bitnami gitlab在ubunti上安装gitlab


如何修复此错误?

您可以使用

# apachectl configtest
Syntax OK
如前所述,端口似乎正在使用中,因此请检查哪个程序正在使用它

# netstat -tulpn

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp6       0      0 :::80                   :::*                    LISTEN      5170/apache2
tcp6       0      0 :::443                  :::*                    LISTEN      5170/apache2
然后用

kill -15 <proces_id>
kill-15

看起来有什么东西已经在使用这个端口了。可能尝试
netstat
检查正在使用它们的内容或重新启动计算机(所有端口都将被释放)。