【问题标题】:Starting Apache2 on Ubuntu Failed在 Ubuntu 上启动 Apache2 失败
【发布时间】:2012-02-16 21:00:49
【问题描述】:

我为 OSQA 使用了 Ubuntu with 和 MYSQL 安装指南。在我到达最后一步,即启动 Apache2 服务器之前,这很简单。我仔细检查了是否错过了前面的任何步骤,而我确实错过了一个。这是 sudo ln -s /etc/apache2/sites-available/osqa /etc/apache2/sites-enabled/osqa 命令。所以我从我的根目录运行了这个命令。运行上述命令后,我尝试再次启动 Apache2 服务器。它仍然没有工作。然后我运行了这些命令:

sudo chmod -R g+w /home/osqa/osqa-server/forum/upfiles
sudo chmod -R g+w /home/osqa/osqa-server/log

这些对问题没有帮助。我启动或重启服务器时遇到的错误是:

osqa@osqa-Latitude-E4300:/$ sudo /etc/init.d/apache2 restart
[sudo] password for osqa: 
Sorry, try again.
[sudo] password for osqa: 
apache2: Syntax error on line 230 of /etc/apache2/apache2.conf: Syntax error on line 7 of /etc/apache2/sites-enabled/osqa: /etc/apache2/sites-enabled/osqa:7: <VirtualHost> was not closed.
Action 'configtest' failed.
The Apache error log may have more information.
   ...fail!

我遵循的安装指南是:http://wiki.osqa.net/display/docs/Ubuntu+with+Apache+and+MySQL

任何帮助将不胜感激!

【问题讨论】:

  • 它告诉你问题所在! &lt;VirtualHost&gt; was not closed - 配置文件中没有&lt;/VirtualHost&gt; 标签。

标签: apache2


【解决方案1】:

您的服务器的配置文件有错误。使用文本编辑器打开 /etc/apache2/apache2.conf 并添加 VirtualHost 结束标记:&lt;/VirtualHost&gt;

【讨论】:

  • 那么只需将 VirtualHost 添加到 apache2.conf 的末尾?
  • 不需要在文件末尾,您可能定义了其他虚拟主机,关闭没有 并且在任何其他开始标签 之前的虚拟主机。你的日志说在第 7 行
【解决方案2】:

结束虚拟主机标签:

&lt;/VirtualHost&gt; (它位于 7 行之后)

【讨论】:

    【解决方案3】:

    这取决于您是否运行多个虚拟主机,您必须在启动另一个虚拟主机之前关闭每个虚拟主机

    <VirtualHost 10.1.2.3:80>
        ServerAdmin webmaster@host.example.com
        DocumentRoot /www/docs/host.example.com
        ServerName host.example.com
        ErrorLog logs/host.example.com-error_log
        TransferLog logs/host.example.com-access_log
    </VirtualHost> 
    

    【讨论】:

      【解决方案4】:

      我的问题是我的一些 ssl 证书有误。确保您的证书和私钥有效且匹配!

      【讨论】:

        猜你喜欢
        • 2015-01-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-08-12
        • 2012-08-01
        • 1970-01-01
        • 2018-07-14
        • 2021-05-31
        相关资源
        最近更新 更多