我有Ubuntu 16.04
服务器并且在使用 Apache 网络服务器时遇到了一个奇怪的问题。
我添加了一个新域名,它将永久重定向到另一个域名。因此,我创建了一个 newdomain.com.conf 文件,其中包含
ServerAdmin [email protected]
ServerName newdomainname.com
ServerAlias www.newdomainname.com
Redirect permanent / http://www.domain.com
然后我通过 启用它a2ensite newdomain.com.conf
。然后,我执行service apache2 restart
以完成该过程,其中我没有收到任何错误消息。
但是 Apache 无法启动并且命令service apache2 status
打印:
apache2.service - LSB: Apache2 web server
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 Sun 2020-03-01 16:05:04 UTC; 27s ago
Docs: man:systemd-sysv-generator(8)
Process: 13416 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 23983 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
Process: 13280 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
Mar 01 16:05:03 kotronis apache2[13280]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Mar 01 16:05:03 kotronis apache2[13280]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Mar 01 16:05:04 kotronis apache2[13280]: no listening sockets available, shutting down
Mar 01 16:05:04 kotronis apache2[13280]: AH00015: Unable to open logs
Mar 01 16:05:04 kotronis apache2[13280]: Action 'start' failed.
Mar 01 16:05:04 kotronis apache2[13280]: The Apache error log may have more information.
Mar 01 16:05:04 kotronis apache2[13280]: *
Mar 01 16:05:04 kotronis apache2[13416]: * Stopping Apache httpd web server apache2
Mar 01 16:05:04 kotronis apache2[13416]: *
Mar 01 16:05:04 kotronis systemd[1]: Started LSB: Apache2 web server.
如果我重新启动服务器,Apache 将正常启动并且service apache2 status
命令打印:
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Sun 2020-03-01 16:07:41 UTC; 7min ago
Docs: man:systemd-sysv-generator(8)
Process: 1261 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
Tasks: 11
Memory: 198.4M
CPU: 5.500s
CGroup: /system.slice/apache2.service
├─ 1440 /usr/sbin/apache2 -k start
├─ 1638 /usr/sbin/apache2 -k start
├─ 1639 /usr/sbin/apache2 -k start
├─ 1642 /usr/sbin/apache2 -k start
├─ 1643 /usr/sbin/apache2 -k start
├─ 1645 /usr/sbin/apache2 -k start
├─ 1781 /usr/sbin/apache2 -k start
├─ 7891 /usr/sbin/apache2 -k start
├─ 8586 /usr/sbin/apache2 -k start
├─ 8890 /usr/sbin/apache2 -k start
└─26106 /usr/sbin/apache2 -k start
Mar 01 16:07:39 kotronis systemd[1]: Starting LSB: Apache2 web server...
Mar 01 16:07:39 kotronis apache2[1261]: * Starting Apache httpd web server apache2
Mar 01 16:07:41 kotronis apache2[1261]: *
Mar 01 16:07:41 kotronis systemd[1]: Started LSB: Apache2 web server.
那么,问题是什么?在 Apache 日志中我也没有收到任何错误。
答案1
告诉我这是否有帮助,来自 apache 文档:
Overlapping Listen directives will result in a fatal error which will prevent the server from starting up. (48)Address already in use: make_sock: could not bind to address [::]:80 See the discussion in the wiki for further troubleshooting tips. ```