我找不到关于如何正确安装配置 apache vhost 的有效描述。大家能帮帮我吗?
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName webpage.com
ServerAlias www.webpage.com
DocumentRoot /home/userdir/webpage.com
Alias /php5-fcgi /usr/lib/cgi-bin
#Alias /php-fpm /home/userdir/webpage.com/php-fpm
FastCgiExternalServer /home/userdir/webpage.com/php5-fcgi -flush -pass-header HTTP_AUTHORIZATION -host 127.0.0.1:11000
#AddType application/x-httpd-fastphp5 .php
#Action appication/x-httpd-fastphp5 /php-fpm
Action php5-fcgi /php5-fcgi
AddHandler php5-fcgi .php
ScriptAlias php5-fcgi /home/userdir/webpage.com/
#DirectoryIndex index.php index.html
<Directory />
Options FollowSymLinks +ExecCGI +SymLinksIfOwnerMatch
#DirectoryIndex index.php
AllowOverride None
</Directory>
<Directory /home/userdir/webpage.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
#DirectoryIndex index.php
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>
浏览器中的输出:
Not Found
The requested URL /php5-fcgi/index.php was not found on this server.
以及 apache 错误日志:
文件不存在:/usr/lib/cgi-bin/index.php
答案1
创建文件/usr/lib/cgi-bin/index.php
并在其中输入一些文本(如“test”),然后保存。再试一次。此外,我认为您不应该使用像 /php5-fcgi 这样的 URL 路径。只需http://localhost/index.php
(或 .html) 即可。