ubuntu 6.10 でWWWサーバ

   

ubuntu 6.10 でApache2によるWWWサーバを構築

WWWサーバの構築

各プログラムのインストール

Apache2のインストール
teckumo@teckumo_server:~$ sudo apt-get install apache2
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
Reading state information... 完了
以下の特別パッケージがインストールされます:
  apache2-common apache2-mpm-worker apache2-utils libapr0 libpcre3
提案パッケージ:
  apache2-doc
以下のパッケージが新たにインストールされます:
  apache2 apache2-common apache2-mpm-worker apache2-utils libapr0 libpcre3
アップグレード: 0 個、新規インストール: 6 個、削除: 0 個、保留: 7 個。
1457kB のアーカイブを取得する必要があります。
展開後に追加で 4714kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com edgy/main libapr0 2.0.55-4ubuntu4 [137kB]
取得:2 http://jp.archive.ubuntu.com edgy/main libpcre3 6.4-2ubuntu1 [174kB]
取得:3 http://jp.archive.ubuntu.com edgy/main apache2-utils 2.0.55-4ubuntu4 [93.1kB]
取得:4 http://jp.archive.ubuntu.com edgy/main apache2-common 2.0.55-4ubuntu4 [807kB]
取得:5 http://jp.archive.ubuntu.com edgy/main apache2-mpm-worker 2.0.55-4ubuntu4 [209kB]
取得:6 http://jp.archive.ubuntu.com edgy/main apache2 2.0.55-4ubuntu4 [36.0kB]
1457kB を 8s で取得しました (169kB/s)
未選択パッケージ libapr0 を選択しています。
(データベースを読み込んでいます ... 現在 90860 個のファイルとディレクトリがインストールされています。)
(.../libapr0_2.0.55-4ubuntu4_i386.deb から) libapr0 を展開しています...
未選択パッケージ libpcre3 を選択しています。
(.../libpcre3_6.4-2ubuntu1_i386.deb から) libpcre3 を展開しています...
未選択パッケージ apache2-utils を選択しています。
(.../apache2-utils_2.0.55-4ubuntu4_i386.deb から) apache2-utils を展開しています...
未選択パッケージ apache2-common を選択しています。
(.../apache2-common_2.0.55-4ubuntu4_i386.deb から) apache2-common を展開しています...
未選択パッケージ apache2-mpm-worker を選択しています。
(.../apache2-mpm-worker_2.0.55-4ubuntu4_i386.deb から) apache2-mpm-worker を展開しています...
未選択パッケージ apache2 を選択しています。
(.../apache2_2.0.55-4ubuntu4_i386.deb から) apache2 を展開しています...
libapr0 (2.0.55-4ubuntu4) を設定しています ...

libpcre3 (6.4-2ubuntu1) を設定しています ...

apache2-utils (2.0.55-4ubuntu4) を設定しています ...
apache2-common (2.0.55-4ubuntu4) を設定しています ...
Setting Apache2 to Listen on port 80. If this is not desired, please edit /etc/apache2/ports.conf as desired. Note that the Port directive no longer works.
Module userdir installed; run /etc/init.d/apache2 force-reload to enable.

apache2-mpm-worker (2.0.55-4ubuntu4) を設定しています ...
 * Starting apache 2.0 web server...                                            apache2: Could not determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                         [ ok ]

apache2 (2.0.55-4ubuntu4) を設定しています ...

teckumo@teckumo_server:~$

MySQLのインストール
teckumo@teckumo_server:~$ sudo apt-get install mysql-server mysql-client
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
Reading state information... 完了
以下の特別パッケージがインストールされます:
  libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl
  mysql-client-5.0 mysql-server-5.0
提案パッケージ:
  dbishell libcompress-zlib-perl tinyca
推奨パッケージ:
  mailx
以下のパッケージが新たにインストールされます:
  libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl mysql-client
  mysql-client-5.0 mysql-server mysql-server-5.0
アップグレード: 0 個、新規インストール: 8 個、削除: 0 個、保留: 13 個。
32.8MB のアーカイブを取得する必要があります。
展開後に追加で 86.6MB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com edgy/main libnet-daemon-perl 0.38-1.1 [45.9kB]
取得:2 http://jp.archive.ubuntu.com edgy/main libplrpc-perl 0.2017-1.1 [35.0kB]
取得:3 http://jp.archive.ubuntu.com edgy/main libdbi-perl 1.51-2 [640kB]
取得:4 http://jp.archive.ubuntu.com edgy/main libdbd-mysql-perl 3.0006-1 [138kB]
取得:5 http://jp.archive.ubuntu.com edgy/main mysql-client-5.0 5.0.24a-9 [6956kB]
取得:6 http://jp.archive.ubuntu.com edgy/main mysql-client 5.0.24a-9 [39.5kB]
取得:7 http://jp.archive.ubuntu.com edgy/main mysql-server-5.0 5.0.24a-9 [24.9MB]
取得:8 http://jp.archive.ubuntu.com edgy/main mysql-server 5.0.24a-9 [39.5kB]
32.8MB を 12s で取得しました (2704kB/s)
パッケージを事前設定しています ...
未選択パッケージ libnet-daemon-perl を選択しています。
(データベースを読み込んでいます ... 現在 90515 個のファイルとディレクトリがインストールされています。)
(.../libnet-daemon-perl_0.38-1.1_all.deb から) libnet-daemon-perl を展開しています...
未選択パッケージ libplrpc-perl を選択しています。
(.../libplrpc-perl_0.2017-1.1_all.deb から) libplrpc-perl を展開しています...
未選択パッケージ libdbi-perl を選択しています。
(.../libdbi-perl_1.51-2_i386.deb から) libdbi-perl を展開しています...
未選択パッケージ libdbd-mysql-perl を選択しています。
(.../libdbd-mysql-perl_3.0006-1_i386.deb から) libdbd-mysql-perl を展開しています...
未選択パッケージ mysql-client-5.0 を選択しています。
(.../mysql-client-5.0_5.0.24a-9_i386.deb から) mysql-client-5.0 を展開しています...
未選択パッケージ mysql-client を選択しています。
(.../mysql-client_5.0.24a-9_all.deb から) mysql-client を展開しています...
未選択パッケージ mysql-server-5.0 を選択しています。
(.../mysql-server-5.0_5.0.24a-9_i386.deb から) mysql-server-5.0 を展開しています...
未選択パッケージ mysql-server を選択しています。
(.../mysql-server_5.0.24a-9_all.deb から) mysql-server を展開しています...
libnet-daemon-perl (0.38-1.1) を設定しています ...
libplrpc-perl (0.2017-1.1) を設定しています ...
libdbi-perl (1.51-2) を設定しています ...
libdbd-mysql-perl (3.0006-1) を設定しています ...
mysql-client-5.0 (5.0.24a-9) を設定しています ...
mysql-client (5.0.24a-9) を設定しています ...
mysql-server-5.0 (5.0.24a-9) を設定しています ...
 * Stopping MySQL database server mysqld                                 [ ok ]
 * Starting MySQL database server mysqld                                 [ ok ]
 * Checking for corrupt, not cleanly closed and upgrade needing tables.

mysql-server (5.0.24a-9) を設定しています ...
teckumo@teckumo_server:~$

PHPのインストール
teckumo@teckumo_server:~$ sudo apt-get install php5 php-pear libapache2-mod-php5
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
Reading state information... 完了
The following packages were automatically installed and are no longer required:
  apache2-mpm-worker
Use 'apt-get autoremove' to remove them.
以下の特別パッケージがインストールされます:
  apache2-mpm-prefork php5-cli php5-common
以下のパッケージは「削除」されます:
  apache2-mpm-worker
以下のパッケージが新たにインストールされます:
  apache2-mpm-prefork libapache2-mod-php5 php-pear php5 php5-cli php5-common
アップグレード: 0 個、新規インストール: 6 個、削除: 1 個、保留: 8 個。
5273kB のアーカイブを取得する必要があります。
展開後に追加で 13.0MB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com edgy/main apache2-mpm-prefork 2.0.55-4ubuntu4 [206kB]
取得:2 http://security.ubuntu.com edgy-security/main php5-common 5.1.6-1ubuntu2.1 [139kB]
取得:3 http://security.ubuntu.com edgy-security/main libapache2-mod-php5 5.1.6-1ubuntu2.1 [2318kB]
取得:4 http://security.ubuntu.com edgy-security/main php5-cli 5.1.6-1ubuntu2.1 [2304kB]
取得:5 http://security.ubuntu.com edgy-security/main php-pear 5.1.6-1ubuntu2.1 [306kB]
取得:6 http://security.ubuntu.com edgy-security/main php5 5.1.6-1ubuntu2.1 [1070B]
5273kB を 2m3s で取得しました (42.6kB/s)
dpkg: apache2-mpm-worker: 依存関係に問題があります。しかし要求に従い削除しています:
 apache2 は以下に依存 (depends) します: apache2-mpm-worker (= 2.0.55-4ubuntu4) | apache2-mpm-prefork (= 2.0.55-4ubuntu4) | apache2-mpm-perchild (= 2.0.55-4ubuntu4) ...しかし:
  Package apache2-mpm-worker is to be removed.
  Package apache2-mpm-prefork is not installed.
  Package apache2-mpm-perchild is not installed.
(データベースを読み込んでいます ... 現在 91348 個のファイルとディレクトリがインストールされています。)
apache2-mpm-worker を削除しています ...
 * Stopping apache 2.0 web server...                                            [ ok ]
未選択パッケージ apache2-mpm-prefork を選択しています。
(データベースを読み込んでいます ... 現在 91344 個のファイルとディレクトリがインストールされています。)
(.../apache2-mpm-prefork_2.0.55-4ubuntu4_i386.deb から) apache2-mpm-prefork を展開しています...
未選択パッケージ php5-common を選択しています。
(.../php5-common_5.1.6-1ubuntu2.1_i386.deb から) php5-common を展開しています...
未選択パッケージ libapache2-mod-php5 を選択しています。
(.../libapache2-mod-php5_5.1.6-1ubuntu2.1_i386.deb から) libapache2-mod-php5 を展開しています...
未選択パッケージ php5-cli を選択しています。
(.../php5-cli_5.1.6-1ubuntu2.1_i386.deb から) php5-cli を展開しています...
未選択パッケージ php-pear を選択しています。
(.../php-pear_5.1.6-1ubuntu2.1_all.deb から) php-pear を展開しています...
未選択パッケージ php5 を選択しています。
(.../php5_5.1.6-1ubuntu2.1_all.deb から) php5 を展開しています...
apache2-mpm-prefork (2.0.55-4ubuntu4) を設定しています ...
 * Starting apache 2.0 web server...                                            [ ok ]

php5-common (5.1.6-1ubuntu2.1) を設定しています ...
libapache2-mod-php5 (5.1.6-1ubuntu2.1) を設定しています ...
 * Forcing reload of apache 2.0 web server...                                   [ ok ]

php5-cli (5.1.6-1ubuntu2.1) を設定しています ...

php-pear (5.1.6-1ubuntu2.1) を設定しています ...

php5 (5.1.6-1ubuntu2.1) を設定しています ...
teckumo@teckumo_server:~$

php5-gdのインストール
teckumo@teckumo_server:~$ sudo apt-get install php5-gd
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
Reading state information... 完了
以下の特別パッケージがインストールされます:
  libgd2-xpm libt1-5
提案パッケージ:
  libgd-tools
以下のパッケージが新たにインストールされます:
  libgd2-xpm libt1-5 php5-gd
アップグレード: 0 個、新規インストール: 3 個、削除: 0 個、保留: 29 個。
373kB のアーカイブを取得する必要があります。
展開後に追加で 1143kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com edgy/main libgd2-xpm 2.0.33-4ubuntu2 [199kB]
取得:2 http://jp.archive.ubuntu.com edgy/main libt1-5 5.1.0-2 [140kB]
取得:3 http://security.ubuntu.com edgy-security/main php5-gd 5.1.6-1ubuntu2.1 [34.1kB]
373kB を 1s で取得しました (240kB/s)
パッケージを事前設定しています ...
未選択パッケージ libgd2-xpm を選択しています。
(データベースを読み込んでいます ... 現在 90479 個のファイルとディレクトリがインストールされています。)
(.../libgd2-xpm_2.0.33-4ubuntu2_i386.deb から) libgd2-xpm を展開しています...
未選択パッケージ libt1-5 を選択しています。
(.../libt1-5_5.1.0-2_i386.deb から) libt1-5 を展開しています...
未選択パッケージ php5-gd を選択しています。
(.../php5-gd_5.1.6-1ubuntu2.1_i386.deb から) php5-gd を展開しています...
libgd2-xpm (2.0.33-4ubuntu2) を設定しています ...
libt1-5 (5.1.0-2) を設定しています ...

php5-gd (5.1.6-1ubuntu2.1) を設定しています ...

teckumo@teckumo_server:~$

php5-mysqlのインストール
teckumo@teckumo_server:~$ sudo apt-get install php5-mysql
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
Reading state information... 完了
以下の特別パッケージがインストールされます:
  libmysqlclient15off mysql-common php5-mysqli
以下のパッケージが新たにインストールされます:
  libmysqlclient15off mysql-common php5-mysql php5-mysqli
アップグレード: 0 個、新規インストール: 4 個、削除: 0 個、保留: 8 個。
1865kB のアーカイブを取得する必要があります。
展開後に追加で 4297kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com edgy/main mysql-common 5.0.24a-9 [42.1kB]
取得:2 http://jp.archive.ubuntu.com edgy/main libmysqlclient15off 5.0.24a-9 [1760kB]
取得:3 http://security.ubuntu.com edgy-security/main php5-mysqli 5.1.6-1ubuntu2.1 [39.5kB]
取得:4 http://security.ubuntu.com edgy-security/main php5-mysql 5.1.6-1ubuntu2.1 [23.1kB]
1865kB を 7s で取得しました (266kB/s)
パッケージを事前設定しています ...
未選択パッケージ mysql-common を選択しています。
(データベースを読み込んでいます ... 現在 91533 個のファイルとディレクトリがインストールされています。)
(.../mysql-common_5.0.24a-9_all.deb から) mysql-common を展開しています...
未選択パッケージ libmysqlclient15off を選択しています。
(.../libmysqlclient15off_5.0.24a-9_i386.deb から) libmysqlclient15off を展開しています...
未選択パッケージ php5-mysqli を選択しています。
(.../php5-mysqli_5.1.6-1ubuntu2.1_i386.deb から) php5-mysqli を展開しています...
未選択パッケージ php5-mysql を選択しています。
(.../php5-mysql_5.1.6-1ubuntu2.1_i386.deb から) php5-mysql を展開しています...
mysql-common (5.0.24a-9) を設定しています ...
libmysqlclient15off (5.0.24a-9) を設定しています ...

php5-mysqli (5.1.6-1ubuntu2.1) を設定しています ...

php5-mysql (5.1.6-1ubuntu2.1) を設定しています ...

teckumo@teckumo_server:~$

WWWサーバの設定

PHPの設定
teckumo@teckumo_server:~$ sudo vi /etc/php5/cli/php.ini
; Example lines:

;extension=mysql.so
extension=mysql.so
;extension=gd.so
extension=gd.so

[mbstring]
; language for internal character representation.
;mbstring.language = Japanese
mbstring.language = Japanese

; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
;mbstring.internal_encoding = EUC-JP
mbstring.internal_encoding = EUC-JP

; http input encoding.
;mbstring.http_input = auto
mbstring.http_input = auto

; http output encoding. mb_output_handler must be
; registered as output buffer to function
;mbstring.http_output = SJIS
mbstring.http_output = EUC-JP

; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
;       portable libs/applications.
;mbstring.encoding_translation = Off
mbstring.encoding_translation = On

; automatic encoding detection order.
; auto means
;mbstring.detect_order = auto
mbstring.detect_order = auto

; substitute_character used when character cannot be converted
; one from another
;mbstring.substitute_character = none;
mbstring.substitute_character = none;


パーミッションの設定
 ubuntuのapt-getでインストールすると、Apache2のユーザはwww-data:www-dataになります。 そこで、まずteckumoのサブグループにwww-dataを追加し、その後パーミッションを設定します。
teckumo@teckumo_server:/home$ sudo chown -R www-data:www-data ssl www
teckumo@teckumo_server:/home$ sudo chmod -R 775 ssl www
teckumo@teckumo_server:/home$ ls -l
合計 12
drwxrwxr-x  2 www-data www-data 4096 2006-11-29 07:38 ssl
drwxr-xr-x 17 teckumo teckumo 4096 2006-11-29 06:56 teckumo
drwxrwxr-x  9 www-data www-data 4096 2006-11-29 07:44 www
teckumo@teckumo_server:/home$

SSLを有効にする
teckumo@teckumo_server:~$ sudo a2enmod ssl
Module ssl installed; run /etc/init.d/apache2 force-reload to enable.
teckumo@teckumo_server:~$ sudo cp /usr/share/doc/apache2/examples/ssl.conf.gz /etc/apache2/sites-available
teckumo@teckumo_server:~$ cd /etc/apache2/sites-available
teckumo@teckumo_server:/etc/apache2/sites-available$ sudo gunzip ssl.conf.gz
teckumo@teckumo_server:/etc/apache2/sites-available$ sudo mv ssl.conf ssl
teckumo@teckumo_server:/etc/apache2/sites-available$ sudo a2ensite ssl
Site ssl installed; run /etc/init.d/apache2 reload to enable.

teckumo@teckumo_server:/etc/apache2/sites-available$

httpd.confの設定
 ubuntuのapt-getでインストールすると、httpd.confの設定がいくつかのファイルに分散されています。 残念ながらこれらのファイルをwebminで設定すると、わけの分からない壊れ方をしてしまったので、 今回は各ファイルを手修正しました。
 設定項目とファイルは、以下の通りです。詳細な設定内容は、他のサイトを参照してください。
ファイル 編集内容
/etc/apache2/apache2.conf Aliasを追加
/etc/apache2/mods-enabled/cgi.load 変更なし
/etc/apache2/mods-enabled/php5.load 変更なし
/etc/apache2/mods-enabled/ssl.load 変更なし
/etc/apache2/mods-enabled/userdir.load 変更なし
/etc/apache2/mods-enabled/php5.conf 変更なし
/etc/apache2/mods-enabled/ssl.conf 変更なし
/etc/apache2/mods-enabled/userdir.conf 変更なし
/etc/apache2/httpd.conf VirtualHostの定義
/etc/apache2/ports.conf 変更なし
/etc/apache2/conf.d/charset UTF-8をEUC-JPに変更
/etc/apache2/sights-enabled/000-default デフォルトのVirtualHost定義
/etc/apache2/sights-enabled/ssl SSLサイトのDirectory定義

コラボリンク

(同)コラボノット
ぎゃらりーぶる
(有)ケイズネットワーク
(有)マルコハウス
西田重和事務所
タケヤ環境計画研究所

スポンサードリンク

ぎゃらりーぶる通販
(株)菊竹金文堂
(有)東和自動車工場

フレンドリンク

(株)シーライズ
Copyright © 2010 TECKUMO All rights reserved.