CentOS apache http 403 err :You don't have permission to access / on this server.

2014090411:19

瀏覽器出現 403 錯誤:

You don't have permission to access / on this server.



httpd 的 error_log 中有這樣的錯誤:

[Thu Sep 04 11:17:26.813763 2014] [core:error] [pid 28901] (13)Permission denied: [client ::1:46116] AH00035: access to / denied (
filesystem path '/home/webuser') because search permissions are missing on a component of the path


可以試試:

 chcon -R -t httpd_sys_content_t /home/webuser  


這個跟 selinux 有關
SELinux  : Security Enhanced Linux

關閉 SELinux 的方法:

# vi /etc/sysconfig/selinux

SELINUX=enforcing
改成
SELINUX=disabled



參考:
程序管理與 SELinux 初探 (鳥哥)





另外 PHP 這樣的錯誤:

Warning: session_start(): open(/var/lib/php/session/sess_7ktfe84jqca3ga6ftk6fsrurv6, O_RDWR) failed: Permission denied (13)

查一下

# vi /etc/httpd/conf.d/php.conf

php_value session.save_path    "/var/lib/php/session"
改為
php_value session.save_path    "/tmp"


# vi /etc/php.ini

設定session.save_path = "/tmp"