Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Apache httpdでIPアドレスやUserAgentでアクセス制御を行うための設定例
# Access is only allowed via local access
# Change this once configured
<Directory /usr/share/a>
AllowOverride Options
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
Require local
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/a/b>
AllowOverride Options
<IfModule mod_authz_core.c>
# Apache 2.4
Require all denied
Require local
Require ip abcd:1234:5678:1::/64
Require ip 192.168.1.1
Require expr %{HTTP_USER_AGENT} =~ /(mobile1|mobile2)/
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.