Apache

概要

Pound環境下のApacheではログにはリモートIPアドレスが127.0.0.1のみが記録されます。
また、Allow fromディレクティブも使用できないようなので困るのですがこのモジュールを使用することで簡単に解決出来ます。

作業ログ

[root@master01 conf.d]# cat /var/log/httpd/www.inamuu.com-access.log | grep 127.0.0.1
127.0.0.1 - - [28/Jan/2014:12:18:44 +0900] "GET /index.php?cmd=backup&page=%E3%83%88%E3%83%83%E3%83%97%E3%83%9A%E3%83%BC%E3%82%B8&age=16&action=nowdiff HTTP/1.1" 302 443 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
[root@master01 conf.d]# yum install mod_extract_forwarded
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
epel/metalink                                                                 | 4.9 kB     00:00
 * base: www.ftp.ne.jp
 * epel: ftp.iij.ad.jp
 * extras: www.ftp.ne.jp
 * updates: centosi5.centos.org
base                                                                          | 3.7 kB     00:00
epel                                                                          | 4.2 kB     00:00  <--epelのレポジトリが必要
epel/primary_db                                                               | 5.9 MB     00:00
extras                                                                        | 3.4 kB     00:00
updates                                                                       | 3.4 kB     00:00
updates/primary_db                                                            | 1.4 MB     00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mod_extract_forwarded.x86_64 0:2.0.2-8.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================
 Package                           Arch               Version                 Repository        Size
=====================================================================================================
Installing:
 mod_extract_forwarded             x86_64             2.0.2-8.el6             epel              15 k

Transaction Summary
=====================================================================================================
Install       1 Package(s)

Total download size: 15 k
Installed size: 29 k
Is this ok [y/N]: y
Downloading Packages: 
mod_extract_forwarded-2.0.2-8.el6.x86_64.rpm                                  |  15 kB     00:00
Running rpm_check_debug
Running Transaction Test 
Transaction Test Succeeded 
Running Transaction
  Installing : mod_extract_forwarded-2.0.2-8.el6.x86_64                                          1/1
  Verifying  : mod_extract_forwarded-2.0.2-8.el6.x86_64                                          1/1

Installed:
  mod_extract_forwarded.x86_64 0:2.0.2-8.el6

Complete!
[root@master01 conf.d]# pwd
/etc/httpd/conf.d
[root@master01 conf.d]# ls -l
合計 40 
-rw-r--r-- 1 root root  392  8月 14 02:30 2013 README
-rw-r--r-- 1 root root 2699  7月 30 07:10 2011 mod_extract_forwarded.conf
[root@master01 conf.d]# cp -p mod_extract_forwarded.conf mod_extract_forwarded.conf.org
[root@master01 conf.d]# vi mod_extract_forwarded.conf 
# MEFaccept 1.2.3.4  1.2.3.5
MEFaccept 127.0.0.1
[root@master01 conf.d]# service httpd configtest
Syntax OK
[root@master01 conf.d]# service httpd graceful
[root@master01 conf.d]# tail -f /var/log/httpd/www.inamuu.com-access.log
182.249.***.*** - - [28/Jan/2014:12:21:34 +0900] "GET /favicon.ico HTTP/1.1" 302 302 "-" "MobileSafari/9537.53 CFNetwork/672.0.8 Darwin/14.0.0"

↑携帯のIPアドレスがログに記述されるようになりました。

参考URL:http://futuremix.org/2012/01/pound-apache-ip-address


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-06-30 (木) 01:40:11