概要 †
リバースプロキシ構成にするので、リバースプロキシ用Apacheとアプリケーションサーバー用Apacheをソースからビルドして導入する。
手順 †
- 前準備。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| -
!
-
!
-
!
-
!
-
!
-
!
-
!
-
!
-
|
!
| gcc -v
yum install gcc
make -v
yum install make
perl -v
yum install perl
yum list | grep zlib-devel
yum install zlib-devel
adduser -Mr www
|
- ソースをダウンロード。
1
2
| -
!
| wget http://ftp.kddilabs.jp/infosystems/apache/httpd/httpd-2.2.*.tar.gz
|
- 展開。
1
2
|
| tar zxvf httpd-2.2.*.tar.gz
cd httpd-2.2.*
|
- makefile作成、ビルド、インストール。
インストール先の指定と、ほぼ全てのモジュールのDSO指定。
1
2
3
4
5
6
7
8
| -
!
-
!
| ./configure --prefix=/opt/httpd_2.2.* \
--with-mpm=worker \
--enable-modules=most \
--enable-mods-shared='all proxy cache disk_cache mem_cache'
make
make install
|
- リバースプロキシ用
- /opt/httpd_2.2.*/conf/httpd.confを編集。
不要なモジュールのロードをやめる。
実効ユーザー、グループをwwwへ変更する。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| -
|
|
|
!
-
!
-
!
-
!
-
!
-
!
-
!
-
!
-
!
-
!
| LoadModule log_config_module modules/mod_log_config.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule mime_module modules/mod_mime.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User www
Group www
</IfModule>
</IfModule>
|
- 動作確認。
1
2
3
| -
!
-
| /opt/httpd_2.2.*/bin/apachectl start
|
- アプリケーションサーバー用
- /opt/httpd_2.2.*/conf/httpd.confを編集。
不要なモジュールのロードをやめる(以下のモジュール以外は全てコメントアウトする)。
実効ユーザー、グループをwwwへ変更する。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| -
|
|
|
!
-
!
-
!
-
!
-
!
-
!
-
!
-
!
-
!
| LoadModule log_config_module modules/mod_log_config.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule mime_module modules/mod_mime.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User www
Group www
</IfModule>
</IfModule>
|
- /opt/httpd_2.2.*/cgi-bin/hello.plを作成。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| -
!
|
use strict;
use CGI;
my $q = CGI->new;
print $q->header(-type => 'text/html', );
print <<"EOS";
<html>
<head>
<title>Hello world</title>
</head>
<body>
<h1>Hello world!!</h1>
<img src="../httpd_logo_wide.gif" />
</body>
</html>
EOS
|
- 権限変更、画像取得。
1
2
3
4
|
-
!
| chmod 755 /opt/httpd_2.2.*/cgi-bin/hello.pl
wget http://httpd.apache.org/images/httpd_logo_wide.gif
mv httpd_logo_wide.gif /opt/httpd_2.2.*/htdocs
|
- 動作確認。
1
2
3
| -
!
-
| /opt/httpd_2.2.*/bin/apachectl start
|
検証時の環境 †
参考 †