求高手:百度无果,访问 index 报 403 ?

设备&amp版本:
腾讯云centos 7.1
apache v2.4
php v5.6
通过composer安装laravel

情况:
在默认根目录/var/www/html下自建的index.php,访问服务器 Ip 能输出phpinfo()信息。(到此)

问题:
修改httpd.conf文件的 DocumentRoot 和 Directory 为laravel项目根目录后(目录路径确认没错),restart httpd重启服务,服务正常。

1、访问服务器ip,显示是apache默认页,如下:
(Testing 123..
This page is used to test the proper operation of the Apache HTTP server after it has been installed. If you can read this page it means that this site is working properly. This server is powered by CentOS.)。

2、访问ip/index.php,报403.如下:
(Forbidden
You don't have permission to access /index.php on this server.)

问:这是什么问题,要如何修改?

其他说明:
1、项目根目录为: (省略部分路径)/composer/pro/
——————
2、httpd/error_log文件如下:(只有一条)
AH01797: client denied by server configuration: (省略部分路径)/composer/pro/public/noindex, referer: http://xxx.xxx.xxx.xxx(服务器ip)/noindex/css/open-sans.css


3、httpd.conf文件如下:
ServerName xxx.xxx.xxx.xxx(服务器Ip):80

AllowOverride All
Require all granted

DocumentRoot "(省略部分路径)/composer/pro/public/"

<Directory "(省略部分路径)/composer/pro/public/">
AllowOverride All
Require all granted

<Directory "(省略部分路径)/composer/pro/public/">(我的conf有2部分directory)

Possible values for the Options directive are "None", "All",

# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
Options Indexes FollowSymLinks
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
AllowOverride All
# Controls who can get stuff from this server.
Require all granted

4、以对pro根目录进行 chmod -R 777 pro
——————
5、本人初入编程,第一次接触服务器。以前在windows下用过laravel,但按照当时视频省略了composer步骤。且windows和linux很多不同。烦请大牛细说。
我百度看了一堆都是说文件权限未777,或者httpd.conf未设allow。然而,我的这些设置均已设~

《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
讨论数量: 5

总感觉是不是少了
Allow from all

6年前 评论

@reatang 不知呢,个人觉得是系统限制了不能非本机访问用户的根文件。搞了一天无果,把laravel项目换到数据盘,就很顺利了

6年前 评论

@000011hao 噗,Apache对于目录的权限首先是Apache能访问的目录(看你启动Apache的用户是什么角色) 然后Apache才能对这些能访问的目录做权限限制呀

6年前 评论

关闭selinux试试或者在网站根目录下运行chcon -R -h -t httpd_sys_content_t

6年前 评论

谢谢各位,此问题已解决,更换项目目录后即可。

6年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!