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