MeWrite Docs

Apache: AH01630 client denied by server configuration

Apacheでクライアントのアクセスがサーバー設定により拒否された場合のエラー

概要

Apache HTTP Serverがクライアントのリクエストをサーバー設定(Directory/Locationディレクティブ)に基づいて拒否した際に、エラーログに記録されるメッセージです。ブラウザにはHTTP 403 Forbiddenが返されます。

エラーメッセージ

[authz_core:error] [pid 12345] [client 192.168.1.1:54321] AH01630: client denied by server configuration: /var/www/html/secret

ブラウザ側:

403 Forbidden
You don't have permission to access this resource.

原因

  1. Require設定の不備: Require all denied がデフォルトで適用されている
  2. Directoryディレクティブの不足: DocumentRoot配下のディレクトリにアクセス許可が定義されていない
  3. .htaccessの設定ミス: Deny from allRequire ディレクティブの誤り
  4. Apache 2.2から2.4への移行問題: Order/Allow/Deny 構文が Require 構文に変更された

解決策

1. Directoryディレクティブでアクセスを許可

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# /etc/apache2/sites-available/000-default.conf(Debian/Ubuntu)
# /etc/httpd/conf/httpd.conf(RHEL/CentOS)

<VirtualHost *:80>
    DocumentRoot /var/www/html

    <Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
1
2
3
4
5
6
# 設定テスト
sudo apachectl configtest

# 再起動
sudo systemctl restart apache2   # Debian/Ubuntu
sudo systemctl restart httpd     # RHEL/CentOS

2. Apache 2.2から2.4への構文移行

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Apache 2.2(古い構文)
<Directory /var/www/html>
    Order allow,deny
    Allow from all
</Directory>

# Apache 2.4(新しい構文)
<Directory /var/www/html>
    Require all granted
</Directory>

IP制限の移行:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Apache 2.2
<Directory /var/www/admin>
    Order deny,allow
    Deny from all
    Allow from 192.168.1.0/24
</Directory>

# Apache 2.4
<Directory /var/www/admin>
    Require ip 192.168.1.0/24
</Directory>

3. .htaccessを確認

1
2
# .htaccessファイルを検索
find /var/www/html -name '.htaccess' -exec echo "=== {} ===" \; -exec cat {} \;
1
2
3
4
# .htaccess で AllowOverride が有効か確認
<Directory /var/www/html>
    AllowOverride All
</Directory>

4. mod_authz_coreモジュールの確認

1
2
3
4
5
6
7
# モジュールが有効か確認
apachectl -M | grep authz

# 必要なモジュールを有効化(Debian/Ubuntu)
sudo a2enmod authz_core
sudo a2enmod authz_host
sudo systemctl restart apache2

関連エラー

Apache の他のエラー

最終更新: 2026-02-03