[Home][Back][Next]

1.Webサーバインストール

# yum -y install httpd
Setting up Install Process
Setting up Repos
base 100% |=========================| 1.1 kB 00:00
updates-released 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
base : ################################################## 2622/2622
primary.xml.gz 100% |=========================| 349 kB 00:00
MD Read : ################################################## 888/888
updates-re: ################################################## 888/888
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package httpd.i386 0:2.0.52-3.1 set to be updated
--> Running transaction check
--> Processing Dependency: httpd-suexec for package: httpd
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Package httpd-suexec.i386 0:2.0.52-3.1 set to be updated
--> Running transaction check

Dependencies Resolved
Transaction Listing:
Install: httpd.i386 0:2.0.52-3.1 - updates-released

Performing the following to resolve dependencies:
Install: httpd-suexec.i386 0:2.0.52-3.1 - updates-released
Total download size: 905 k
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: httpd 100 % done 1/2
Installing: httpd-suexec 100 % done 2/2

Installed: httpd.i386 0:2.0.52-3.1
Dependency Installed: httpd-suexec.i386 0:2.0.52-3.1
Complete!

# yum -y install php
Setting up Install Process
Setting up Repos
base 100% |=========================| 1.1 kB 00:00
updates-released 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
base : ################################################## 2622/2622
updates-re: ################################################## 888/888
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package php.i386 0:4.3.11-2.4 set to be updated
--> Running transaction check
--> Processing Dependency: php-pear for package: php
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Package php-pear.i386 0:4.3.11-2.4 set to be updated
--> Running transaction check

Dependencies Resolved
Transaction Listing:
Install: php.i386 0:4.3.11-2.4 - updates-released

Performing the following to resolve dependencies:
Install: php-pear.i386 0:4.3.11-2.4 - updates-released
Total download size: 1.6 M
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: php-pear 100 % done 1/2
Installing: php 100 % done 2/2

Installed: php.i386 0:4.3.11-2.4
Dependency Installed: php-pear.i386 0:4.3.11-2.4
Complete!

# yum clean packages
Cleaning up Packages
4 packages removed

2.Webサーバ設定

# vi /etc/httpd/conf/httpd.conf
変更前 変更後 内容
ServerTokens OS ServerTokens Prod エラーページなどでOS名を表示しない
ServerAdmin root@localhost ServerAdmin post@kkataru.mine.nu 管理者メールアドレス
#ServerName new.host.name:80 ServerName ataru08.kkataru.mine.nu:80 サーバ名の記載
Options Indexes FollowSymLinks Options Includes ExecCGI FollowSymLinks CGI、SSIの許可
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
.htaccessの許可
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
長すぎるURI(414エラー)
はログに記録しない
#
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#








CustomLog logs/access_log combined
#
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
SetEnvIf Request_URI "default\.ida" no_log
SetEnvIf Request_URI "cmd\.exe" no_log
SetEnvIf Request_URI "root\.exe" no_log
SetEnvIf Request_URI "Admin\.dll" no_log
SetEnvIf Request_URI "NULL\.IDA" no_log
SetEnvIf Request_URI "\.(gif)|(jpg)|(png)|(ico)|(css)$" no_log
SetEnvIf Remote_Addr 192.168.1 no_log

CustomLog logs/access_log combined env=!no_log
Wormのアクセスログを
記録しない方法
gif等の画像のアクセス
ログを記録しない方法
ServerSignature On ServerSignature Off エラーページ等でapacheの
バージョンを表示しない
AddDefaultCharset UTF-8 # AddDefaultCharset UTF-8 キャラクタ設置解除
#AddHandler cgi-script .cgi AddHandler cgi-script .cgi .pl cgiに.plの追加

Perlコマンドへ/usr/local/bin/perlsでもアクセスできるようにする。
# ln -s /usr/bin/perl /usr/local/bin/perl
# which perl

/usr/local/bin/perl

ドキュメントルートの変更(vi /etc/httpd/conf/httpd.conf)
DocumentRoot "/home/ataru/web"

#
# This should be changed to whatever you set DocumentRoot to.
#
##<Directory "/var/www/html">
<Directory "/home/ataru/web">

パーミッションの変更
# chmod 755 /home/ataru

3.Webサーバの起動

# /etc/init.d/httpd start
httpd を起動中: [ OK ]

4.Webサーバの自動起動設定

# chkconfig httpd on
# chkconfig --list httpd

httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[Home][Back][Next]

Copyright (C) 2005 ataru