求高手:百度无果,访问 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。然而,我的这些设置均已设~

《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
讨论数量: 5

总感觉是不是少了
Allow from all

8年前 评论

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

8年前 评论

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

8年前 评论

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

8年前 评论

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

8年前 评论