我正在尝试安装 apache2(以设置 LAMP 堆栈),但似乎有东西正在使用 HTTP 端口0.0.0.0:80
。
还有一篇关于无法确定服务器的完全限定名称的文本帖子。
以下是完整文章:
invoke-rc.d: initscript apache2, action "start" failed.
● 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 Wed 2019-05-22 15:57:55 UTC; 10ms ago
Process: 28139 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
May 22 15:57:55 scilab_comp_0 apachectl[28139]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.222. Set the 'ServerName' directive globally to suppress this message
May 22 15:57:55 scilab_comp_0 apachectl[28139]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
May 22 15:57:55 scilab_comp_0 apachectl[28139]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
May 22 15:57:55 scilab_comp_0 apachectl[28139]: no listening sockets available, shutting down
May 22 15:57:55 scilab_comp_0 apachectl[28139]: AH00015: Unable to open logs
May 22 15:57:55 scilab_comp_0 apachectl[28139]: Action 'start' failed.
May 22 15:57:55 scilab_comp_0 apachectl[28139]: The Apache error log may have more information.
May 22 15:57:55 scilab_comp_0 systemd[1]: apache2.service: Control process exited, code=exited status=1
May 22 15:57:55 scilab_comp_0 systemd[1]: apache2.service: Failed with result 'exit-code'.
May 22 15:57:55 scilab_comp_0 systemd[1]: Failed to start The Apache HTTP Server.
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for systemd (237-3ubuntu10.21) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ...
Rules updated for profile 'OpenSSH'
关于服务器的域名。我刚刚使用路由器的 DDNS 功能为其创建了一个域名,并通过将所有端口转发到该服务器使其成为 DMZ。
我应该如何解决这个问题并让 Apache 启动?
编辑0:
sarah@scilab_comp_0:~$ sudo netstat -tlpn | grep :80
tcp6 0 0 :::80 :::* LISTEN 3034/httpd
答案1
启动 apache2 时,您可以看到所有使用端口 80 的进程:
sudo lsof -i TCP:80
而且我认为解决您所面临的问题的最简单方法是将您的端口更改为其他端口,您可以在 apache 2 配置中的这两个文件中更改它们:
/etc/apache2/ports.conf
/etc/apache2/sites-enabled/000-default.conf
此后你应该用这个命令重新启动 apache2:
sudo /etc/init.d/apache2 restart
另外,为了获得更好的结果,您可以运行此命令来查看启动 apache2 时缺少什么或者出现什么问题:
systemctl status apache2.service