我在我的 Ubuntu 16.04LTS 机器上按如下方式安装了 apache2:
$ sudo apt-get upgrade
$ sudo apt-get install apache2
这里一切正常。但是在我输入以下内容之后:
$ sudo systemctl start apache2
$ sudo systemctl status apache2
结果显示:
apache2.service - LSB: Apache2 web serve
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: inactive (dead) since Tue 2017-05-16 21:00:45 CST; 16s ago
Docs: man:systemd-sysv-generator(8)
Process: 5436 ExecStop=/etc/init.d/apache2 stop (code=exited,status=0/SUCCESS
Process: 5420 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCE
May 16 21:00:45 shayuxiong-X555LPB apache2[5420]: (98)Address already in use: AH
May 16 21:00:45 shayuxiong-X555LPB apache2[5420]: (98)Address already in use: AH
May 16 21:00:45 shayuxiong-X555LPB apache2[5420]: no listening sockets available
May 16 21:00:45 shayuxiong-X555LPB apache2[5420]: AH00015: Unable to open logs
May 16 21:00:45 shayuxiong-X555LPB apache2[5420]: Action 'start' failed.
May 16 21:00:45 shayuxiong-X555LPB apache2[5420]: The Apache error log may have
May 16 21:00:45 shayuxiong-X555LPB apache2[5420]: *
May 16 21:00:45 shayuxiong-X555LPB apache2[5436]: * Stopping Apache httpd web s
May 16 21:00:45 shayuxiong-X555LPB apache2[5436]: *
May 16 21:00:45 shayuxiong-X555LPB systemd[1]: Started LSB: Apache2 web server.
然后我卸载 apache2 并重新安装它,但情况仍然发生。那么我该如何激活 apache2?“没有可用的监听套接字”是什么意思?我对 LAMP 安装和这个平台完全陌生。提前谢谢 :)
答案1
请尝试以下解决方案:
nginx server
通过打开/etc/nginx/sites-available
并将端口或线路更改listen: 80
为您喜欢的任何端口来改变监听端口。重新加载
nginx server
:sudo systemctl restart nginx
现在尝试重新安装 apache。