[root at mobile httpd-2 dot 0.54]# tar -zxvf httpd-2.0.54.tar.gz
[root at mobile httpd-2 dot 0.54]# cd httpd-2.0.54 www.shengfang.org
./configure --prefix=/home/sf/www/apache --enable-module=so --enable-module=most
./configure --prefix=/home/sf/www/apache --enable-shared=max --enable-module=most
./configure --prefix=/usr/local/apache www.shengfang.org
make www.shengfang.org
make install
Installing build system files
make[1]: Leaving directory `/home/sf/tmp/httpd-2.0.54'
[root at mobile apache]# dot /bin/apachectl start
httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
结果
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
--------------------------------------------------------------------------------
原因可能是:
1、你没有为该目录或者该文件设置guest组权限;
2、你没有将该文件名设置为默认页面,尤其是在仅用域名访问的情况下。
解决办法:
chmod 701 /home/www
chmod 701 /home/www/*
vi /usr/local/apache/conf/httpd.conf
DirectoryIndex index.html index.jsp index.xtp index.php index.php3
ElTopo网友提示“ls -l /var/www/html/index.html 应该是 rw-r--r-- ”。上网查询后得知是文件的访问权限设置过于严格造成的。于是使用chmod 775 /var/www/html/index.html解决问题。不单纯是单个文件的读写权限的问题,父目录的读写权限如果设置太过严格也会产生问题。chmod 775除了everyone的写权限被封锁以外,剩余的权限全部打开。当然也可以在图形界面下,找到相应的文件或文件夹右击->属性->权限进行更改。大概就是这么多,谢谢各位。
修改
ServerSignature On 为 ServerSignature Off. www.shengfang.org
[root at mobile bin]# dot /apachectl start
httpd: could not open document config file /home/sf/www/apache\xa1\xa1--enable-so/conf/httpd.conf
Installing build system files
make[1]: Leaving directory `/home/sf/tmp/httpd-2.0.54'
为什么无论访问服务器的那个页面都会被提示"Forbidden/You don’t have permission to access on this server"?
查找Apache的配置文件,里面包含<Files ~>的内容,如果有这个字符串, 那么表示你的Apache配置关于<Files>容器的定义有问题,把它修改成<Files ~ "^.ht">就可以了。
注意:用Redhat 6.x版本的linuxconf来配置Apache会导致这个错误, 如果再次使用还会出现这个问题。
我读取apache服务器某个目录的时候会提示”Forbidden”
底层文件系统不允许运行Apache服务的用户或者组来访问这个目录,或者Apache配置里面对这个目录有访问限制都会造成这个问题。你可以查看错误日志来发现究竟是什么原因引起的。
注意:如果是文件系统的原因,解决这个问题,必须让Apache的运行用户对这个目录有读权限,同时对这个目录的所有父目录具有搜索权限。
make[1]: Leaving directory `/home/sf/tmp/apache_1.3.33'
+--------------------------------------------------------+
| You now have successfully built and installed the |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the |
| (initially created or preserved) configuration files |
| |
| /home/sf/www/apache/conf/httpd.conf
| |
| and then you should be able to immediately fire up |
| Apache the first time by running: |
| |
| /home/sf/www/apache/bin/apachectl start
| |
| Thanks for using Apache. The Apache Group |
| http://www.apache.org/ |
+--------------------------------------------------------+
Why do I get a "Forbidden" message whenever I try to access a particular directory?
This message is generally caused because either
The underlying file system permissions do not allow the User/Group under which Apache is running to access the necessary files; or
The Apache configuration has some access restrictions in place which forbid access to the files.
You can determine which case applies to your situation by checking the error log.
In the case where file system permission are at fault, remember that not only must the directory and files in question be readable, but also all parent directories must be at least searchable (i.e., chmod +x /directory/path) by the web server in order for the content to be accessible. www.shengfang.org
--------------------------------------------------------------------------------
Why do I get a "Forbidden/You don't have permission to access / on this server" message whenever I try to access my server?
Search your conf/httpd.conf file for this exact string: <Files ~>. If you find it, that's your problem -- that particular <Files> container is malformed. Delete it or replace it with <Files ~ "^\.ht"> and restart your server and things should work as expected.
This error appears to be caused by a problem with the version of linuxconf distributed with Redhat 6.x. It may reappear if you use linuxconf again.
If you don't find this string, check out the previous question.
还是不能解决www.shengfang.org 2.0试验了,1.3也试验了~