我刚刚使用以下命令从源代码安装了 apache 和 php:
./configure --prefix="/mnt/workspace/servers/web/apache-2.2.17" \
--enable-info --enable-rewrite --enable-usertrack --enable-mime-magic
对于 Apache 和
./configure --with-apxs2=/mnt/workspace/servers/web/apache-2.2.17/bin/apxs \
--prefix=/mnt/workspace/servers/web/apache-2.2.17/php \
--with-config-file-path=/mnt/workspace/servers/web/apache-2.2.17/php \
--with-mysql=mysqlnd
对于 php。调整配置(httpd.conf)并启动 apache 后,它会在http://localhost:8060/index.html(假设使用8060)请求。
httpd.conf中有以下目录设置:
<Directory "/mnt/workspace/servers/web/apache-2.2.17/htdocs">
...
Order allow,deny
Allow from all
...
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
值得注意的是,我已经在已安装(安装 ubuntu 时配置的默认自动安装)分区上安装了 apache。
日志文件
访问日志:
::1 - - [12/Feb/2011:17:48:30 +0200] "GET / HTTP/1.1" 403 202
::1 - - [12/Feb/2011:17:48:31 +0200] "GET /favicon.ico HTTP/1.1" 403 213
::1 - - [12/Feb/2011:17:48:48 +0200] "GET /index.html HTTP/1.1" 403 212
::1 - - [12/Feb/2011:17:48:48 +0200] "GET /favicon.ico HTTP/1.1" 403 213
::1 - - [12/Feb/2011:17:49:03 +0200] "GET /index.html HTTP/1.1" 403 212
::1 - - [12/Feb/2011:17:49:03 +0200] "GET /favicon.ico HTTP/1.1" 403 213
错误日志:
[Sat Feb 12 18:59:13 2011] [notice] Apache/2.2.17 (Unix) PHP/5.3.5 configured -- resuming normal operations
[Sat Feb 12 18:59:22 2011] [error] [client ::1] (13)Permission denied: access to / denied
[Sat Feb 12 18:59:22 2011] [error] [client ::1] (13)Permission denied: access to /favicon.ico denied
[Sat Feb 12 18:59:36 2011] [error] [client ::1] (13)Permission denied: access to /index.html denied
答案1
解决方案相当尴尬,我不知道发生了什么。基本上是因为我的帐户对已安装的文件系统 (ntfs) 没有权限,使用 sudo 启动 apache,并且只有 root 组能够访问文件,这使得任何用户都无法获得非 403 响应。格式化为 ext4 就解决了问题。:D