我正试图从头开始安装我的Apache2,它安装时没有启用任何模块,也没有任何相关的默认配置,可以被视为"网络主机"(实际上html显示为文本,PHP文件下载)
无论如何,我在httpd.conf 中有这个
# Default Directory Settings
<Directory />
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
</Directory>
index.html似乎在默认情况下可以查找,但index.php不起作用。我做错了什么?
<VirtualHost *:80>
ServerAdmin webmaster@localhost
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_value include_path .
</IfModule>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
DocumentRoot /home/was/www
<Directory /home/was/www/>
Options FollowSymLinks
Options +ExecCGI Indexes FollowSymLinks MultiViews
DirectoryIndex index.html index.php
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Location /cgi-bin >
SetHandler cgi-script
Options +ExecCGI
</Location>
<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>
注意所有的技巧只是为了让事情正常工作,比如PHP。这很烦人。
显然,如果您没有启用站点,Apache2可能仍然会加载文件并使用其中的一些设置。
特别地,这个文件声明了我的一个IP要使用,并在一个新端口上转发到一个新的www文档根目录。即使在禁用网站的情况下,这也是有效的,但<directory>
和其他设置不起作用,直到我启用它。
我的糟糕,但奇怪的功能在Apache2方面。