712 瀏覽數

HTTP Error

Apache Http Web Server 測試時,首頁網頁看起來很正常.

但自行產生的 phpinfo.php 卻不能看,網頁顯示.

Forbidden

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

檢查一下 http 的 錯誤訊息 /var/log/httpd/error_log

[root@localhost ~]$ cat /var/log/httpd/error_log

[Tue Aug 15 11:18:37.335214 2017] [authz_core:error] [pid 20673] [client 192.168.42.189:54334] AH01630: client denied by server configuration: /var/ftp/phpinfo.php

原來我把 http 的根目錄改成為 /var/ftp ,相對的權限目錄也需要修改才對.

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/ftp"

#
# Relax access to content within /var/www.
#
#<Directory "/var/www">
<Directory "/var/ftp">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

修改完成重啟服務即可.

[root@localhost ~]$ systemctl restart httpd

發表迴響