Apache2 配置错误:“<VirtualHost> 未关闭”错误

6 ubuntu configuration apache-2.2

所以我已经检查了我的配置文件,我真的看不到任何标签没有正确关闭的实例......但我一直收到这个配置错误......你介意看看这个错误吗?和下面的配置文件?任何帮助将不胜感激。

仅供参考,我已经从错误中搜索了生命并广泛查看了日志,我真的找不到任何东西。

错误:

apache2:/etc/apache2/apache2.conf 的第 236 行的语法错误:/etc/apache2/sites-enabled/000-default 的第 1 行的语法错误:/etc/apache2/sites-enabled/000-default:1 : 没有关闭。

apache2.conf 的第 236 行:

# Include the virtual host configurations:                                      
Include /etc/apache2/sites-enabled/   
Run Code Online (Sandbox Code Playgroud)

000-default 的内容:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>


<VirtualHost *:443>
        SetEnvIf Request_URI "^/u" dontlog
        ErrorLog /var/log/apache2/error.log
        Loglevel warn
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/apache.pem

        ProxyRequests Off
        <Proxy *>
                AuthUserFile /srv/ajaxterm/.htpasswd
                AuthName EnterPassword
                AuthType Basic
                require valid-user

                Order Deny,allow
                Allow from all
        </Proxy>
        ProxyPass / http://localhost:8022/
        ProxyPassReverse / http://localhost:8022/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

更新

我的安装有很多其他问题,所以我只是擦拭并重新安装。如果我遇到同样的问题,我会重新发布。

大家,感谢您的帮助/建议。

小智 -2

我不想在未来回答,但在第 5 行,你的标签格式错误, <Directory /> 应该是 <Directory "/">

我还遇到了 unix 和 windows 以及我的 apache 配置文件之间的行结束字符问题。

  • Apache 配置文件不是 XML。它们在某些方面看起来很相似,但并不遵循相同的规则。 (3认同)