大家。
我有一个带有Apache + mod_php站点(site1.local)的Cent OS 6.6服务器。我需要用php_cgi配置第二个站点(site2.local)。所以,我创建了一个用户,给了他www-folder的权限,将site1配置为mod_php,创建了一个phpinfo.php。另外,我安装了php-cgi,并尝试配置虚拟主机,只在第一个站点工作,在第二个站点上是错误的:
the requested url /cgi-bin/phpinfo.php was not found onthis server.
这是我的配置: cat /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
ServerAdmin webmaster@site1.local
DocumentRoot /var/www/wwwmaster/site1.local
ServerName site1.local
ServerAlias www.site1.local
ErrorLog logs/site1.local-error_log
CustomLog logs/site1.local-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@site2.local
DocumentRoot /var/www/wwwmaster/site2.local
ServerName site2.local
ServerAlias www.site2.local
ScriptAlias /cgi_bin/ /usr/bin/php-cgi/
Action php-cgi /cgi-bin
AddHandler php-cgi php
<Directory /usr/bin/php-cgi>
Allow from all
</Directory>
<Directory "/var/www/wwwmaster/site2.local/">
<FilesMatch "\.php">
SetHandler php-cgi
</FilesMatch>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
ErrorLog logs/site2.local-error_log
CustomLog logs/site2.local-access_log common
</VirtualHost>
我做错了什么,如何解决?
答案 0 :(得分:0)
您只需取消注释apache配置文件中显示NameVirtualServer *:80
的行。
如果您希望虚拟服务器支持多个端口,只需在apache配置文件中添加尽可能多的NameVirtualServer *:[port number]
。