7
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

apache2.x で任意のURL配下のみIPアドレス制限をかける

Last updated at Posted at 2016-04-26

やり方

  • Locationタグで設定する
  • Locationタグは.htaccessでは使用できないので、confファイルに記載する

作業順

  1. confファイルのバックアップ
  2. 制限を与えたいディレクトリの情報を以下のように記載
  3. apachectl configtestで設定を確認
  4. httpd reloadで設定を読み込み
  5. IP制限あり、無しの環境からアクセスを行い制限が働いているか+他影響でていないかを確認(だいたいはWiFiを切ったスマホからアクセスすれば制限ありを確認できるはず)

*設定全体は管理者権限で行う

設定例

<Location "/hoge">
 order deny,allow
 deny from all
 allow from 1.1.1.1
 allow from 2.2.2.2
</Location>

*許可IPアドレスが複数ある場合、allow fromは複数行記載。

7
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?