【问题标题】:Apache2 cgi-bin location not updatingApache2 cgi-bin 位置未更新
【发布时间】:2016-08-23 20:34:52
【问题描述】:

首先感谢您的帮助。我正在尝试将网站移植到新版本的 linux (Raspian Jessie),但遇到了一些问题,apache2 是 2.4.10 版。主要是让 cgi-bin 文件夹正确更新。我已经更新了 /etc/apache2/sites-available/ 中的默认文件以反映我希望目录所在的位置,但 apache 仍在尝试使用旧的 cgi-bin 位置,因此给了我一个 404 时我尝试在网络浏览器中查看该页面。我目前的配置如下:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

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

    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    <Directory "/var/www/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, warn, error, crit,
    # alert, emerg.
    LogLevel warn

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

错误日志表明 apache 仍在 /usr/lib/cgi-bin/ 目录中查找 cgi 文件,我似乎无法让它更新到新位置。任何想法。

【问题讨论】:

  • Apache 没有按照你的描述做,你肯定有错误。这个虚拟主机里面没有ServerName,你有其他虚拟主机吗?如果有,请求可能会“登陆”另一个虚拟主机。使用apachectl -S 检查您真正拥有的虚拟主机以及默认/首次加载的虚拟主机。
  • 系统上只有一个虚拟主机,我要从当前部署的系统中关闭的配置不包括 ServerName 条目,如果现在需要我会添加它。您建议的命令的返回是:VirtualHost configuration: ServerRoot: "/etc/apache2" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/var/log/apache2" Mutex default: dir="/var/lock/apache2" mechanism=fcntl Mutex watchdog-callback: using_defaults PidFile: "/var/run/apache2/apache2.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG Define: ENABLE_USR_LIB_CGI_BIN

标签: linux apache raspberry-pi debian cgi-bin


【解决方案1】:

您没有正确使用“包含”来加载您的 VirtualHost 文件,因此 apachectl -S 输出在“VirtualHost 配置:”之后没有显示任何内容,它会继续下一部分。它应该在那里列出您的虚拟主机并说它是默认的,因为它只有一个。

查看您的包含指令

【讨论】:

  • 查看 apache2.conf 文件(如果我理解正确的话),有如下声明:# Include the virtual hosts configurations: IncludeOptional siteds-enabled/*.conf 这是我有一个指向站点可用目录的符号链接的目录,并且其中所需的配置文件。这是默认的 apache2.config 文件,我应该更改什么吗?
  • 选址?那是一个错字。确保您的包含正确。复核,复核,再复核。正确包含虚拟主机详细信息将显示在 apachectl -S 的输出中。
  • 我放在这里的时候打错了。尽管感谢您的建议,我对所有内容进行了三次检查,并注意到 /sites-available 中的文件中缺少 .conf 扩展名。可能是因为我试图将文件从站点的已部署版本复制到新操作系统上的新安装中。
猜你喜欢
  • 1970-01-01
  • 2013-10-03
  • 1970-01-01
  • 1970-01-01
  • 2014-05-04
  • 2011-12-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多