将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