我刚刚对 httpd.conf 文件进行了更改。我这样做的原因是我正在尝试设置子域。我现在想重新启动 apache2,但当我尝试重新启动时,我遇到了一系列错误。具体来说,我添加了此处的更改https://stackoverflow.com/questions/4203580/creating-subdomains-in-amazon-ec2到 httpd.conf 文件
<VirtualHost *:80>
ServerName subdomain.example.com
ServerAdmin [email protected]
DocumentRoot /var/www/example.com/subdomain
<Directory /var/www/example.com/subdomain>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/subdomain.example.com.error.log
LogLevel warn
CustomLog /var/log/apache2/subdomain.example.com.access.log combined
</VirtualHost>
但是当我尝试重新启动 apache 时出现以下错误。
AH00112: Warning: DocumentRoot [/var/www/xxx.com/subdomain] does not exist
(2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at /xxx/xxx/apache2/conf/httpd.conf:193
AH00014: Configuration check failed
apache config test fails, aborting
AH00112: Warning: DocumentRoot [/var/www/xxxcom/subdomain] does not exist
(2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at /opt/bitnami/apache2/conf/httpd.conf:193
AH00014: Configuration check failed
apache config test fails, aborting
让我们分解这些错误
AH00112: Warning: DocumentRoot [/var/www/xxx.com/subdomain] does not exist (2)No such file or directory:
要解决这个问题,我是否应该添加文件 /var/www/xxx.com/subdomain?如果是,它应该是空的还是应该包含内容
。如果它应该包含内容,那么应该包含什么类型的内容?AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at
我不知道这意味着什么或者该怎么办。
/xxx/xxx/apache2/conf/httpd.conf:193AH00014: Configuration check failed apache config test fails, aborting
我也不确定在这里该做什么。AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at /xxx/xxx/apache2/conf/httpd.conf:193
我是否做了同样的事情并出现错误 AH00112
答案1
确保缺少的目录已创建。这些目录也应具有适当的权限。通常 755 权限就足够了。
示例如下。
mkdir /var/www/example.com/subdomain
mkdir /var/log/apache2
用实际目录名称替换 example.com 和子域。