【问题标题】:Debian Apache2 Restart issueDebian Apache2 重启问题
【发布时间】:2015-08-08 17:12:42
【问题描述】:

问题是我的服务器必须安装,所以我试图让 www 中的网站启动并运行。我已经复制了 www 的旧内容,但是当我尝试重新启动 apache2 时,我得到以下信息:

root@microsoft:/# service apache2 restart
Syntax error on line 1 of /etc/apache2/sites-enabled/microsoft.com:
Invalid command '../sites-available/microsoft.com', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.

etc/apache2/sites-enabled/microsoft.com 文件内部:../sites-available/microsoft.com

/etc/apache2/sites-available 文件内:

<VirtualHost *:80>
ServerAdmin admin@microsoft.com
ServerName microsoft.com
ServerAlias www.microsoft.com   

DocumentRoot /var/www/microsoft
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/microsoft>
    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 ${APACHE_LOG_DIR}/error.log

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

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

任何帮助都会很棒!

【问题讨论】:

  • 尝试在 之后使用 再次关闭您的

标签: bash apache unix apache2 debian


【解决方案1】:

再次尝试在&lt;/Directory&gt; 之后使用&lt;/VirtualHost&gt; 关闭您的&lt;VirtualHost *:80&gt;

<VirtualHost *:80>
    ServerAdmin admin@microsoft.com
    ServerName microsoft.com
    ServerAlias www.microsoft.com   

    DocumentRoot /var/www/microsoft
    <Directory "/var/www/microsoft">
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/microsoft>
        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>
</VirtualHost>
ErrorLog ${APACHE_LOG_DIR}/error.log

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

CustomLog ${APACHE_LOG_DIR}/access.log combined

【讨论】:

  • 我在底部有虚拟主机行,我忘记将它粘贴到我的问题中。问题仍然存在,知道它可能是什么吗?谢谢!
  • 我已经更新了代码,第一个目录应该是什么?
  • root@microsoft:/# a2ensite microsoft:.com 错误:站点 microsoft.com 未正确启用:/etc/apache2/sites-enabled /microsoft:.com 是一个真实文件,没有触及它
  • 当我在线访问我的网站时,它会在我的 www 中显示网站文件夹,如果单击它们会转到该网站,但域本身在使用时不会路由到该网站。每个域都指向 www 文件夹。
  • 添加一个 DirectiryIndex,例如 DirectoryIndex index.html。更多信息:httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex
【解决方案2】:

您的符号链接似乎不正确,并且文件的启用站点版本已损坏。

"etc/apache2/sites-enabled/microsoft.com 里面的文件: ../sites-available/microsoft.com"

您正在显示站点可用文件的内容,但错误消息暗示站点启用文件的内容不是有效的 httpd 配置。

遵循现有模式并仔细阅读错误消息。

【讨论】:

    【解决方案3】:

    尝试在启用站点中删除您的 microsoft.com 文件,将 microsoft.com 重命名为 microsoft.com。conf 在站点可用中。运行 a2ensite 并重启 apache2 服务。

    【讨论】:

      猜你喜欢
      • 2021-11-14
      • 1970-01-01
      • 2016-05-08
      • 1970-01-01
      • 1970-01-01
      • 2019-02-18
      • 2019-03-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多