将DocumentRoot 设置为/home/jaakan/www/ROOT 当前用户是 jaakan 1.更改目录权限 chmod o+x /home/jaakan/www chmod o+x /h
将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)注释掉 <Directory />
<Directory /> AllowOverride none Require all denied</Directory>
2)修改DocumentRoot 与 Directory标签
DocumentRoot "/home/jaakan/www/ROOT"<Directory "/home/jaakan/www"> AllowOverride None # Allow open access: Require all granted</Directory><Directory "/home/jaakan/www/ROOT"> Options Indexes FollowSymLinks AllowOverride None Require all granted</Directory>
3)修改 User 与 Group
User jaakanGroup jaakan
附上更改之后的http.conf 文件
ServerRoot "/etc/httpd"Listen 80Include conf.modules.d/*.confUser jaakanGroup jaakanServerAdmin root@localhostDocumentRoot "/home/jaakan/www/ROOT"<Directory "/home/jaakan/www"> AllowOverride None # Allow open access: Require all granted</Directory><Directory "/home/jaakan/www/ROOT"> Options Indexes FollowSymLinks AllowOverride None Require all granted</Directory><IfModule dir_module> DirectoryIndex index.html</IfModule><Files ".ht*"> Require all denied</Files>ErrorLog "logs/error_log"LogLevel warn<IfModule log_config_module> LogFormat "%h %l %u %t /"%r/" %>s %b /"%{Referer}i/" /"%{User-Agent}i/"" combined LogFormat "%h %l %u %t /"%r/" %>s %b" common <IfModule logio_module> # 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 </IfModule> CustomLog "logs/access_log" combined</IfModule><IfModule alias_module> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"</IfModule><Directory "/var/www/cgi-bin"> AllowOverride None Options None Require all granted</Directory><IfModule mime_module> TypesConfig /etc/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType text/html .shtml AddOutputFilter INCLUDES .shtml</IfModule>AddDefaultCharset UTF-8<IfModule mime_magic_module> MIMEMagicFile conf/magic</IfModule>EnableSendfile onIncludeOptional conf.d/*.conf
3.到此 , 页面已经不会显示403错误了,但是出来的是一个空白页面 这是selinux在搞鬼 selinux不会设置,索性就关掉了 然后就OK了
最后说明下我的centos及apache版本:
centos: centos7
apache: Apache/2.4.6