所以我正在尝试设置虚拟主机。
我已经制作了灯泡服务器,并尝试安装多个wordpress网页。 当我创建虚拟主机文件时,问题就开始了。启用它后,Apache不想重新加载。
它给出了这个错误。
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
命令systemctl status apache2.service
显示
● 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: active (running) (Result: exit-code) since Sat 2019-11-09 19:11:47 CET; 19h ago
Process: 23833 ExecStop=/usr/sbin/apachectl stop (code=exited,status=0/SUCCESS)
Process: 28860 ExecReload=/usr/sbin/apachectl graceful (code=exited,status=1/FAILURE)
Process: 23838 ExecStart=/usr/sbin/apachectl start (code=exited,status=0/SUCCESS)
Main PID: 23850 (apache2)
Tasks: 7 (limit: 2299)
CGroup: /system.slice/apache2.service
├─23850 /usr/sbin/apache2 -k start
├─28782 /usr/sbin/apache2 -k start
├─28783 /usr/sbin/apache2 -k start
├─28784 /usr/sbin/apache2 -k start
├─28785 /usr/sbin/apache2 -k start
├─28786 /usr/sbin/apache2 -k start
└─28790 /usr/sbin/apache2 -k start
journalctl -xe
命令显示了
Nov 10 14:52:18 ozols01 apachectl[28773]: AH00558: apache2: Could not reliably determine the server's fully q
Nov 10 14:52:18 ozols01 systemd[1]: Reloaded The Apache HTTP Server.
Nov 10 15:00:30 ozols01 systemd[1]: Reloading The Apache HTTP Server.
Nov 10 15:09:05 ozols01 apachectl[28892]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name,using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Nov 10 15:09:05 ozols01 apachectl[28892]: (2)No such file or directory: AH02291: Cannot access directory '/etc/apache2/$var/log/apache2/' for error log of vhost defined at /etc/apache2/sites-enabled/example1.conf:1
Nov 10 15:09:05 ozols01 apachectl[28892]: AH00014: Configuration check failed
Nov 10 15:09:05 ozols01 apachectl[28892]: action 'graceful' failed.
Nov 10 15:09:05 ozols01 apachectl[28892]: The Apache error log may have more information.
Nov 10 15:09:05 ozols01 systemd[1]: apache2.service: Control process exited,code=exited status=1
Nov 10 15:09:05 ozols01 systemd[1]: Reload failed for The Apache HTTP Server.
-- Subject: Unit apache2.service has finished reloading its configuration
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit apache2.service has finished reloading its configuration
--
-- The result is RESULT.
Nov 10 15:09:05 ozols01 systemd[1]: Started Clean php session files.
-- Subject: Unit phpsessionclean.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit phpsessionclean.service has finished starting up.
--
-- The start-up result is RESULT.
这是我的虚拟主机文件
<VirtualHost *:80>
ServerAdmin admin@example1.com
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/html/example1.com/public_html
ErrorLog $var/log/apache2/error.log
CustomLog $var/log/apache2/access.log combined
</VirtualHost>
如何解决这个问题?