apache --访问私人web时出现403错误
来源:百度文库 编辑:神马文学网 时间:2024/05/21 21:39:24
问题1:
[root@centos45 ~]# /etc/rc.d/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: Could not determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName
# vi /etc/httpd/conf/httpd.conf [添加]
ServerNamewww.centos45.com:80
问题2:访问 http://10.10.7.246/~feng 时,提示错误:
Forbidden
You don‘t have permission to access /~feng on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
经做步骤:
# vi /etc/httpd/conf/httpd.conf
。。略。。
#UserDir disable
UserDir public_html
。。略。。
AllowOverride All
Options IncludesNoExec ExecCGI FollowSymLinks
Order allow,deny
Allow from all
Order deny,allow
Deny from all
# su - feng
$ cd
$ mkdir public_html
$ chmod 755 public_html
$ chmod 755 ~ [很重要]
缺乏步骤:[问题所在点]
[root@centos45 home]# ls -Z feng
drwxr-xr-x feng feng user_u:object_r:user_home_t public_html
[root@centos45 home]# chcon -R -t httpd_user_content_t feng/public_html/
[root@centos45 home]# ls -Z feng
drwxr-xr-x feng feng user_u:object_r:httpd_user_content_t public_html
参考资料:
http://wuhuizhong.itpub.net/post/11594/281904
[root@centos45 ~]# /etc/rc.d/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: Could not determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName
# vi /etc/httpd/conf/httpd.conf [添加]
ServerNamewww.centos45.com:80
问题2:访问 http://10.10.7.246/~feng 时,提示错误:
Forbidden
You don‘t have permission to access /~feng on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
经做步骤:
# vi /etc/httpd/conf/httpd.conf
。。略。。
#UserDir disable
UserDir public_html
。。略。。
AllowOverride All
Options IncludesNoExec ExecCGI FollowSymLinks
Order allow,deny
Allow from all
Order deny,allow
Deny from all
# su - feng
$ cd
$ mkdir public_html
$ chmod 755 public_html
$ chmod 755 ~ [很重要]
缺乏步骤:[问题所在点]
[root@centos45 home]# ls -Z feng
drwxr-xr-x feng feng user_u:object_r:user_home_t public_html
[root@centos45 home]# chcon -R -t httpd_user_content_t feng/public_html/
[root@centos45 home]# ls -Z feng
drwxr-xr-x feng feng user_u:object_r:httpd_user_content_t public_html
参考资料:
http://wuhuizhong.itpub.net/post/11594/281904