:
apache错误:403 Forbidden
这两天配置joomla的时候,总是报如下的错误,
Forbidden
You don't have permission to access / on this server.
Apache/2.2.3 (Red Hat) Server at joomla.test.com Port 80
在网上找了好些文章,看了都大同小异的说是apache的配置文件/ect/httpd/conf/httpd.conf不对,照着改了,错误还是如此;
今天偶然在 /var/www/ 目录下运行命令:
ls -Z
[root@laolinux]# ls -Z
drwxr-xr-x root root system_u:object_r:httpd_sys_script_exec_t cgi-bin
drwxr-xr-x root root root:object_r:httpd_sys_content_t data
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t error
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t html
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t icons
drwxr-xr-x root root root:object_r:user_home_t test
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t manual
才想着rhel5.1是有selinux的,而且默认是启用的,test文件夹也是在root的home目录里解压后拷贝过来的;
所以需要改一下test文件夹的selinux属性设置,用如下命令:
[root@laolinux]# chcon -R -t httpd_sys_content_t test/
再看一下:
[root@laolinux]# ls -Z
drwxr-xr-x root root system_u:object_r:httpd_sys_script_exec_t cgi-bin
drwxr-xr-x root root root:object_r:httpd_sys_content_t data
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t error
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t html
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t icons
drwxr-xr-x root root root:object_r:httpd_sys_content_t test
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t manual
重启一下apache: service httpd restart
然后就可以用浏览器访问了。OK,问题解决。
****************************************************
** by : laolinux
** my blog: http://laolinux.cublog.cn
****************************************************
阅读(1292) | 评论(0) | 转发(0) |