php webserver documentroot,centos7解决apache更改DocumentRoot后无法访问的问题

将DocumentRoot 设置为/home/jaakan/www/ROOT    当前用户是 jaakan

1.更改目录权限

chmod o+x/home/jaakan/www

chmod o+x/home/jaakan/www/ROOT

2.更改/etc/httpd/conf/httpd.conf

1)注释掉

AllowOverride none

Require all denied

2)修改DocumentRoot 与 Directory标签

DocumentRoot "/home/jaakan/www/ROOT"

AllowOverride None

# Allow open access:

Require all granted

Options Indexes FollowSymLinks

AllowOverride None

Require all granted

3)修改 User 与 Group

User jaakan

Group jaakan

附上更改之后的http.conf 文件

ServerRoot "/etc/httpd"

Listen 80

Include conf.modules.d/*.conf

User jaakan

Group jaakan

ServerAdmin root@localhost

DocumentRoot "/home/jaakan/www/ROOT"

AllowOverride None

# Allow open access:

Require all granted

Options Indexes FollowSymLinks

AllowOverride None

Require all granted

DirectoryIndex index.html

Require all denied

ErrorLog "logs/error_log"

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

# You need to enable mod_logio.c to use %I and %O

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

CustomLog "logs/access_log" combined

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

AllowOverride None

Options None

Require all granted

TypesConfig /etc/mime.types

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

AddType text/html .shtml

AddOutputFilter INCLUDES .shtml

AddDefaultCharset UTF-8

MIMEMagicFile conf/magic

EnableSendfile on

IncludeOptional conf.d/*.conf

3.到此 , 页面已经不会显示403错误了,但是出来的是一个空白页面 这是selinux在搞鬼  selinux不会设置,索性就关掉了  然后就OK了

最后说明下我的centos及apache版本:

centos:  centos7

apache: Apache/2.4.6

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值