apache のインストール

Debian LS-XHL

ちょっと Web サーバが必要になって、 死蔵している LS-XHL を Web サーバに仕立てることにした。

Linux マシンとしてのセットアップは殆ど出来たので、 いよいよ Web サーバとしてセットアップしていく。

apache のインストール

root@xhl:~# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common file libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libexpat1 libldap-2.4-2
  libmagic1 libsasl2-2 libsasl2-modules mime-support openssl ssl-cert
Suggested packages:
  www-browser apache2-doc apache2-suexec apache2-suexec-custom
  libsasl2-modules-otp libsasl2-modules-ldap libsasl2-modules-sql
  libsasl2-modules-gssapi-mit libsasl2-modules-gssapi-heimdal ca-certificates
  openssl-blacklist
The following NEW packages will be installed:
  apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common file
  libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libexpat1
  libldap-2.4-2 libmagic1 libsasl2-2 libsasl2-modules mime-support openssl
  ssl-cert
0 upgraded, 18 newly installed, 0 to remove and 0 not upgraded.
Need to get 2902 kB of archives.
After this operation, 10.1 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://security.debian.org/ wheezy/updates/main openssl armel 1.0.1e-2+deb7u13 [704 kB]
Get:2 http://ftp.jp.debian.org/debian/ wheezy/main libsasl2-2 armel 2.1.25.dfsg1-6+deb7u1 [110 kB]
Get:3 http://ftp.jp.debian.org/debian/ wheezy/main libldap-2.4-2 armel 2.4.31-1+nmu2 [217 kB]
Get:4 http://ftp.jp.debian.org/debian/ wheezy/main libmagic1 armel 5.11-2+deb7u5 [201 kB]
Get:5 http://ftp.jp.debian.org/debian/ wheezy/main libexpat1 armel 2.1.0-1+deb7u1 [116 kB]
Get:6 http://ftp.jp.debian.org/debian/ wheezy/main file armel 5.11-2+deb7u5 [52.2 kB]
Get:7 http://ftp.jp.debian.org/debian/ wheezy/main mime-support all 3.52-1 [35.5 kB]
Get:8 http://ftp.jp.debian.org/debian/ wheezy/main libapr1 armel 1.4.6-3+deb7u1 [93.8 kB]
Get:9 http://ftp.jp.debian.org/debian/ wheezy/main libaprutil1 armel 1.4.1-3 [76.8 kB]
Get:10 http://ftp.jp.debian.org/debian/ wheezy/main libaprutil1-dbd-sqlite3 armel 1.4.1-3 [18.1 kB]
Get:11 http://ftp.jp.debian.org/debian/ wheezy/main libaprutil1-ldap armel 1.4.1-3 [16.0 kB]
Get:12 http://ftp.jp.debian.org/debian/ wheezy/main apache2.2-bin armel 2.2.22-13+deb7u3 [678 kB]
Get:13 http://ftp.jp.debian.org/debian/ wheezy/main apache2-utils armel 2.2.22-13+deb7u3 [164 kB]
Get:14 http://ftp.jp.debian.org/debian/ wheezy/main apache2.2-common armel 2.2.22-13+deb7u3 [293 kB]
Get:15 http://ftp.jp.debian.org/debian/ wheezy/main apache2-mpm-worker armel 2.2.22-13+deb7u3 [2250 B]
Get:16 http://ftp.jp.debian.org/debian/ wheezy/main apache2 armel 2.2.22-13+deb7u3 [1446 B]
Get:17 http://ftp.jp.debian.org/debian/ wheezy/main libsasl2-modules armel 2.1.25.dfsg1-6+deb7u1 [104 kB]
Get:18 http://ftp.jp.debian.org/debian/ wheezy/main ssl-cert all 1.0.32 [19.5 kB]
Fetched 2902 kB in 34s (84.6 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libsasl2-2:armel.
(Reading database ... 14984 files and directories currently installed.)
Unpacking libsasl2-2:armel (from .../libsasl2-2_2.1.25.dfsg1-6+deb7u1_armel.deb) ...
Selecting previously unselected package libldap-2.4-2:armel.
Unpacking libldap-2.4-2:armel (from .../libldap-2.4-2_2.4.31-1+nmu2_armel.deb) ...
Selecting previously unselected package libmagic1:armel.
Unpacking libmagic1:armel (from .../libmagic1_5.11-2+deb7u5_armel.deb) ...
Selecting previously unselected package libexpat1:armel.
Unpacking libexpat1:armel (from .../libexpat1_2.1.0-1+deb7u1_armel.deb) ...
Selecting previously unselected package file.
Unpacking file (from .../file_5.11-2+deb7u5_armel.deb) ...
Selecting previously unselected package mime-support.
Unpacking mime-support (from .../mime-support_3.52-1_all.deb) ...
Selecting previously unselected package libapr1.
Unpacking libapr1 (from .../libapr1_1.4.6-3+deb7u1_armel.deb) ...
Selecting previously unselected package libaprutil1.
Unpacking libaprutil1 (from .../libaprutil1_1.4.1-3_armel.deb) ...
Selecting previously unselected package libaprutil1-dbd-sqlite3.
Unpacking libaprutil1-dbd-sqlite3 (from .../libaprutil1-dbd-sqlite3_1.4.1-3_armel.deb) ...
Selecting previously unselected package libaprutil1-ldap.
Unpacking libaprutil1-ldap (from .../libaprutil1-ldap_1.4.1-3_armel.deb) ...
Selecting previously unselected package apache2.2-bin.
Unpacking apache2.2-bin (from .../apache2.2-bin_2.2.22-13+deb7u3_armel.deb) ...
Selecting previously unselected package apache2-utils.
Unpacking apache2-utils (from .../apache2-utils_2.2.22-13+deb7u3_armel.deb) ...
Selecting previously unselected package apache2.2-common.
Unpacking apache2.2-common (from .../apache2.2-common_2.2.22-13+deb7u3_armel.deb) ...
Selecting previously unselected package apache2-mpm-worker.
Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.22-13+deb7u3_armel.deb) ...
Selecting previously unselected package apache2.
Unpacking apache2 (from .../apache2_2.2.22-13+deb7u3_armel.deb) ...
Selecting previously unselected package libsasl2-modules:armel.
Unpacking libsasl2-modules:armel (from .../libsasl2-modules_2.1.25.dfsg1-6+deb7u1_armel.deb) ...
Selecting previously unselected package openssl.
Unpacking openssl (from .../openssl_1.0.1e-2+deb7u13_armel.deb) ...
Selecting previously unselected package ssl-cert.
Unpacking ssl-cert (from .../ssl-cert_1.0.32_all.deb) ...
Processing triggers for man-db ...
Setting up libsasl2-2:armel (2.1.25.dfsg1-6+deb7u1) ...
Setting up libldap-2.4-2:armel (2.4.31-1+nmu2) ...
Setting up libmagic1:armel (5.11-2+deb7u5) ...
Setting up libexpat1:armel (2.1.0-1+deb7u1) ...
Setting up file (5.11-2+deb7u5) ...
Setting up mime-support (3.52-1) ...
Setting up libapr1 (1.4.6-3+deb7u1) ...
Setting up libaprutil1 (1.4.1-3) ...
Setting up libaprutil1-dbd-sqlite3 (1.4.1-3) ...
Setting up libaprutil1-ldap (1.4.1-3) ...
Setting up apache2.2-bin (2.2.22-13+deb7u3) ...
Setting up apache2-utils (2.2.22-13+deb7u3) ...
Setting up apache2.2-common (2.2.22-13+deb7u3) ...
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.
Enabling module reqtimeout.
Setting up apache2-mpm-worker (2.2.22-13+deb7u3) ...
[....] Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.6 for ServerName
. ok
Setting up apache2 (2.2.22-13+deb7u3) ...
Setting up libsasl2-modules:armel (2.1.25.dfsg1-6+deb7u1) ...
Setting up openssl (1.0.1e-2+deb7u13) ...
Setting up ssl-cert (1.0.32) ...
!root@xhl:~#

動作確認

LS-XHL へ ブラウザからアクセスすると、

It works!

設定

自分のページ apache の設定 を参考に apache の設定をする
root@xhl:~# cd /etc/apache2/sites-available/
root@xhl:/etc/apache2/sites-available# mv default{,.orig}
root@xhl:/etc/apache2/sites-available# cp default{.orig,}
root@xhl:/etc/apache2/sites-available# vi default
	:
	:
root@xhl:/etc/apache2/sites-available# !diff
diff -u default{.orig,}
--- default.orig        2014-07-24 05:56:40.000000000 +0900
+++ default     2014-10-26 06:52:17.505066250 +0900
@@ -1,21 +1,24 @@
 
+       ServerName www.yamasita.jp
        ServerAdmin webmaster@localhost

-       DocumentRoot /var/www
+       HostnameLookups On
+
+       DocumentRoot /home/httpd/html
        
                Options FollowSymLinks
                AllowOverride None
        
-       
+       
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        

-       ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
-       
-               AllowOverride None
+       ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/
+       
+               AllowOverride All
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
@@ -28,4 +31,5 @@
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
+
 
root@xhl:/etc/apache2/sites-available#
こんなかんじか??

ディレクトリの作成

Vine の頃からの慣れで、 /home/httpd 以下を apache で使うように設定したので、 それに合わせてディレクトリを作成する
root@xhl:/etc/apache2/sites-available# cd /mnt
root@xhl:/mnt# ls -l
total 0
root@xhl:/mnt# cd /
root@xhl:/# mv home /mnt
root@xhl:/# ln -s /mnt/home .
root@xhl:/# ls -ld /home
lrwxrwxrwx 1 root root 9 Oct 26 06:54 /home -> /mnt/home
root@xhl:/# mkdir /home/httpd
root@xhl:/# grep www /etc/group
www-data:x:33:
root@xhl:/# 
group を www-data にして、set gid bit をたてておく。
root@xhl:/# chgrp www-data /home/httpd/
root@xhl:/# chmod 2775 !$
chmod 2775 /home/httpd/
root@xhl:/# ls -ld !$
ls -ld /home/httpd/
drwxrwsr-x 2 root www-data 6 Oct 26 06:55 /home/httpd/
root@xhl:/# mkdir /home/httpd/html
root@xhl:/# mkdir /home/httpd/cgi-bin
root@xhl:/# ls -l /home/httpd
total 0
drwxr-sr-x 2 root www-data 6 Oct 26 06:56 cgi-bin
drwxr-sr-x 2 root www-data 6 Oct 26 06:56 html
root@xhl:/#

apache の再起動

root@xhl:/# /etc/init.d/apache2 restart
[....] Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.6 for ServerName
 ... waiting .apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.6 for ServerName
. ok
root@xhl:/#
ん?
DNS への登録は正しいはずなのに、、、

動作確認

ブラウザで http://192.168.1.6 をアクセスして、
何もコンテンツを置いていないので、
Index of /

LS-XHL
バッファローダイレクト
楽天市場
amazon
ValuMore


ftp, less のインストール
ハックの記録
LinkStation/玄箱 をハックしよう

コンテンツのコピー

ツイート Tweet to @yasunari_y @yasunari_yをフォロー

Copyright (C) 2003-2014 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市