apache の設定

Debian TS-WXL

Debian の apache の設定値を見る。
特に気になるのは、html と cgi-bin とがどのディレクトリに 配置されているか。

httpd.conf は何処に?

yasunari@tswxl:~$ cd /etc/apache2/
yasunari@tswxl:/etc/apache2$ ls -l
total 40
-rw-r--r-- 1 root root 10104 Mar 29 04:11 apache2.conf
drwxr-xr-x 2 root root 4096 May 30 23:33 conf.d
-rw-r--r-- 1 root root 378 Mar 29 04:11 envvars
-rw-r--r-- 1 root root 0 May 30 23:33 httpd.conf
drwxr-xr-x 2 root root 4096 May 30 23:33 mods-available
drwxr-xr-x 2 root root 4096 May 30 23:33 mods-enabled
-rw-r--r-- 1 root root 513 Mar 29 04:11 ports.conf
drwxr-xr-x 2 root root 4096 May 30 23:33 sites-available
drwxr-xr-x 2 root root 4096 May 30 23:33 sites-enabled
yasunari@tswxl:/etc/apache2$
すんなりと見つかった。でも、ちょっと変。0バイト。

設定ファイルを見る

ヒョッとすると、apache2.conf が httpd.conf 相当?
yasunari@tswxl:/etc/apache2$ grep httpd apache2.conf
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# at );
Include /etc/apache2/httpd.conf
yasunari@tswxl:/etc/apache2$
やっぱり、apache2.conf が httpd.conf を Include している。 と言うことは、httpd.conf に固有の設定だけをすれば良いのか???

見つからない

DocumentRoot やら cgi-bin を grep してみたが、、、
yasunari@tswxl:/etc/apache2$ grep DocumentRoot *
yasunari@tswxl:/etc/apache2$ grep cgi-bin *
apache2.conf:#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
yasunari@tswxl:/etc/apache2$
設定ファイルにはない。
と言うことは、コンパイル時デフォルト?

サブディレクトリまで探すと、、、

tswxl:/etc/apache2# grep DocumentRoot */*
sites-available/default: DocumentRoot /var/www/
sites-available/default-ssl: DocumentRoot /var/www/
sites-enabled/000-default: DocumentRoot /var/www/
tswxl:/etc/apache2#
見つかった。

サイト固有の設定

どうやらサイト固有の設定は /etc/apache2/sites-available/default ですれば良いようだ。
tswxl:/etc/apache2# cat sites-available/default
<VirtualHost *:80>
 ServerName www.yamasita.jp
 ServerAdmin webmaster@localhost
 DocumentRoot /home/httpd/html
 <Directory />
 Options FollowSymLinks
 AllowOverride None
 </Directory>
 <Directory //home/httpd/html/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 </Directory>
 ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/
 <Directory "/home/httpd/cgi-bin">
 AllowOverride None
 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
 </Directory>
 ErrorLog /var/log/apache2/error.log
 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn
 CustomLog /var/log/apache2/access.log combined
 Alias /doc/ "/usr/share/doc/"
 <Directory "/usr/share/doc/">
 Options Indexes MultiViews FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all
 Allow from 127.0.0.0/255.0.0.0 ::1/128
 </Directory>
</VirtualHost>
tswxl:/etc/apache2#

ディレクトリの作成

tswxl:/etc/apache2# cd /
tswxl:/# ls -l
total 101
drwxr-xr-x 2 root root 4096 May 7 06:58 bin
drwxr-xr-x 3 root root 4096 May 14 23:37 boot
drwxr-xr-x 5 root root 36864 Jun 2 2010 dev
drwxr-xr-x 52 root root 4096 Jun 2 2010 etc
drwxr-xr-x 3 root root 4096 Mar 16 23:24 home
drwxr-xr-x 19 root root 1024 Mar 7 23:30 initrd
drwxr-xr-x 10 root root 12288 May 30 23:33 lib
drwxr-xr-x 2 root root 4096 Mar 6 23:34 media
drwxr-xr-x 3 root root 19 May 14 21:53 mnt
drwxr-xr-x 2 root root 4096 Mar 6 23:34 opt
dr-xr-xr-x 60 root root 0 Jan 1 1970 proc
drwxr-xr-x 2 root root 4096 Apr 10 19:11 root
drwxr-xr-x 2 root root 4096 May 15 06:17 sbin
drwxr-xr-x 2 root root 4096 Sep 16 2008 selinux
drwxr-xr-x 2 root root 4096 Mar 6 23:34 srv
drwxr-xr-x 10 root root 0 Jan 1 1970 sys
drwxrwxrwt 2 root root 4096 Jun 2 2010 tmp
drwxr-xr-x 10 root root 4096 Mar 6 23:34 usr
drwxr-xr-x 14 root root 4096 May 30 23:33 var
tswxl:/# 
まずは、/home を /mnt に移動し、シンボリックリンクを張る
tswxl:/# ls /mnt
Backup
tswxl:/# tar cf - home |(cd /mnt; tar xvf -)
home/
home/yamasita/
home/yamasita/yasunari/
home/yamasita/yasunari/.lesshst
home/yamasita/yasunari/.profile
home/yamasita/yasunari/.bash_logout
home/yamasita/yasunari/.bashrc
home/yamasita/yasunari/.bash_history
tswxl:/# rm -fr /home
tswxl:/# ln -s /mnt/home/ /
tswxl:/# ls -l /
total 97
drwxr-xr-x 2 root root 4096 May 7 06:58 bin
drwxr-xr-x 3 root root 4096 May 14 23:37 boot
drwxr-xr-x 5 root root 36864 Jun 2 2010 dev
drwxr-xr-x 52 root root 4096 Jun 2 2010 etc
lrwxrwxrwx 1 root root 10 Jun 1 22:56 home -> /mnt/home/
drwxr-xr-x 19 root root 1024 Mar 7 23:30 initrd
drwxr-xr-x 10 root root 12288 May 30 23:33 lib
drwxr-xr-x 2 root root 4096 Mar 6 23:34 media
drwxr-xr-x 4 root root 30 Jun 1 22:56 mnt
drwxr-xr-x 2 root root 4096 Mar 6 23:34 opt
dr-xr-xr-x 60 root root 0 Jan 1 1970 proc
drwxr-xr-x 2 root root 4096 Apr 10 19:11 root
drwxr-xr-x 2 root root 4096 May 15 06:17 sbin
drwxr-xr-x 2 root root 4096 Sep 16 2008 selinux
drwxr-xr-x 2 root root 4096 Mar 6 23:34 srv
drwxr-xr-x 10 root root 0 Jan 1 1970 sys
drwxrwxrwt 2 root root 4096 Jun 2 2010 tmp
drwxr-xr-x 10 root root 4096 Mar 6 23:34 usr
drwxr-xr-x 14 root root 4096 May 30 23:33 var
tswxl:/#
続いて、/home/httpd/{html,cgi-bin} を作る
tswxl:/# mkdir -p /home/httpd/html
tswxl:/# mkdir -p /home/httpd/cgi-bin
tswxl:/#

apache の再起動

新しい設定で起動する。
tswxl:/etc/apache2# /etc/init.d/apache2 restart
Restarting web server: apache2 ... waiting ..
tswxl:/etc/apache2#
さて、どのぐらい Vine と違うものやら、、、



apache のインストール
ハックの記録
LinkStation/玄箱 をハックしよう
Backup を cron から実行

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

AltStyle によって変換されたページ (->オリジナル) /