【发布时间】: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