我试图设置php5.6.23作为我的服务器上使用php7作为主版本的快速CGI
但在我的一个领域,我得到这个错误:
The requested URL / was not found on this server.
这里是我的虚拟主机conf:
ScriptAlias / /usr/lib/cgi-bin DocumentRoot "/home/ue4xxxx/www" <Directory "/home/ue4xxxx/www"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all AddHandler php-cgi .php Action php-cgi /cgi-bin/php-cgi-5.6.23 <FilesMatch "\.php*"> SetHandler php-cgi </FilesMatch> </Directory> ErrorLog ${APACHE_LOG_DIR}/ue4/error.log CustomLog ${APACHE_LOG_DIR}/ue4/access.log combined
我有php cgi bin位于/usr/lib/cgi-bin
,我想使用vhost root /home/ue4xxxx/www
更新 :以下几点build议后,虚拟主机conf现在是:
<VirtualHost *:80> ServerAdmin [email protected] ServerName ue4-xxxx.tld ServerAlias ue4-xxxx.tld ScriptAlias /cgi-bin /usr/lib/cgi-bin DocumentRoot "/home/ue4xxxx/www" <Directory "/home/ue4xxxx/www"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all AddHandler php-cgi .php Action php-cgi /cgi-bin/php-cgi-5.6.23 <FilesMatch "\.php"> SetHandler php-cgi </FilesMatch> </Directory> ErrorLog ${APACHE_LOG_DIR}/ue4/error.log CustomLog ${APACHE_LOG_DIR}/ue4/access.log combined </VirtualHost>
这些更改后,我得到一个404错误:
The requested URL /cgi-bin/php-cgi-5.6.23/index.php was not found on this server
你在这里有一个错误:
<FilesMatch "\.php*">
“*” 不是您使用它的通配符,而是“重复先前的匹配零次或多次”。
您应该查看正则expression式的Apache文档,并将FilesMatch
更改为:
<FilesMatch "\.php">
另外:它看起来像:
ScriptAlias / /usr/lib/cgi-bin
应该可能是:
ScriptAlias /cgi-bin /usr/lib/cgi-bin
您可以查看ScriptAlias指令的Apache文档以获取更多的使用细节。