我尝试在 Ubuntu 16.04 上启动 apache2,但是失败:
thong@ubuntu:/etc/apache2/sites-enabled$ sudo /etc/init.d/apache2 start
[....] Starting apache2 (via systemctl): apache2.serviceJob for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
failed!
thong@ubuntu:/etc/apache2/sites-enabled$ systemctl status apache2.service
● 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: failed (Result: exit-code) since Mon 2017-07-03 11:44:49 ICT; 24s ago
Docs: man:systemd-sysv-generator(8)
Process: 2201 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Jul 03 11:44:49 ubuntu apache2[2201]: *
Jul 03 11:44:49 ubuntu apache2[2201]: * The apache2 configtest failed.
Jul 03 11:44:49 ubuntu apache2[2201]: Output of config test was:
Jul 03 11:44:49 ubuntu apache2[2201]: apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/apache2
Jul 03 11:44:49 ubuntu apache2[2201]: Action 'configtest' failed.
Jul 03 11:44:49 ubuntu apache2[2201]: The Apache error log may have more information.
Jul 03 11:44:49 ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Jul 03 11:44:49 ubuntu systemd[1]: Failed to start LSB: Apache2 web server.
Jul 03 11:44:49 ubuntu systemd[1]: apache2.service: Unit entered failed state.
Jul 03 11:44:49 ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.
是第 219 行:
IncludeOptional sites-enabled/*.conf
输出namei -lx /etc/apache2/sites-enabled/apache2
thong@ubuntu:/etc/apache2/sites-enabled$ namei -lx /etc/apache2/sites-enabled/apache2
f: /etc/apache2/sites-enabled/apache2
Drwxr-xr-x root root /
drwxr-xr-x root root etc
drwxr-xr-x root root apache2
drwxr-xr-x root root sites-enabled
apache2 - No such file or directory
输出ls -l /etc/apache2/sites-enabled/
thong@ubuntu:~$ ls -l /etc/apache2/sites-enabled/
total 0
lrwxrwxrwx 1 root root 35 Jun 2 16:52 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 46 Jun 29 14:35 apache2-passenger-host.conf -> ../sites-available/apache2-passenger-host.conf
我该如何修复这个错误?