HTTP Error

Loading

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
沒有解決問題,試試搜尋本站其他內容

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料