HTTPサーバー構築
30 11 月 2007まずApache HTTPサーバー、PHPをインストールする
# yum -y install httpd Loading "installonlyn" plugin Loading "fastestmirror" plugin Setting up Install Process Setting up repositories base 100% |=========================| 1.1 kB 00:00 updates 100% |=========================| 951 B 00:00 addons 100% |=========================| 951 B 00:00 extras 100% |=========================| 1.1 kB 00:00 Loading mirror speeds from cached hostfile Reading repository metadata in from local files Parsing package install arguments Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Downloading header for httpd to pack into transaction set. httpd-2.2.3-7.el5.centos. 100% |=========================| 54 kB 00:00 ---> Package httpd.i386 0:2.2.3-7.el5.centos set to be updated --> Running transaction check Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: httpd i386 2.2.3-7.el5.centos updates 1.1 M Transaction Summary ============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 1.1 M Downloading Packages: (1/1): httpd-2.2.3-7.el5. 100% |=========================| 1.1 MB 00:00 Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: httpd ######################### [1/1] Installed: httpd.i386 0:2.2.3-7.el5.centos Complete! # yum -y install php php-mbstring Loading "installonlyn" plugin Loading "fastestmirror" plugin Setting up Install Process Setting up repositories Loading mirror speeds from cached hostfile Reading repository metadata in from local files Parsing package install arguments Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Downloading header for php-mbstring to pack into transaction set. php-mbstring-5.1.6-15.el5 100% |=========================| 16 kB 00:00 ---> Package php-mbstring.i386 0:5.1.6-15.el5 set to be updated ---> Downloading header for php to pack into transaction set. php-5.1.6-15.el5.i386.rpm 100% |=========================| 18 kB 00:00 ---> Package php.i386 0:5.1.6-15.el5 set to be updated --> Running transaction check --> Processing Dependency: php-cli = 5.1.6-15.el5 for package: php --> Processing Dependency: php-common = 5.1.6-15.el5 for package: php-mbstring --> Processing Dependency: php-common = 5.1.6-15.el5 for package: php --> Restarting Dependency Resolution with new changes. --> Populating transaction set with selected packages. Please wait. ---> Downloading header for php-common to pack into transaction set. php-common-5.1.6-15.el5.i 100% |=========================| 19 kB 00:00 ---> Package php-common.i386 0:5.1.6-15.el5 set to be updated ---> Downloading header for php-cli to pack into transaction set. php-cli-5.1.6-15.el5.i386 100% |=========================| 17 kB 00:00 ---> Package php-cli.i386 0:5.1.6-15.el5 set to be updated --> Running transaction check Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: php i386 5.1.6-15.el5 updates 1.2 M php-mbstring i386 5.1.6-15.el5 updates 968 k Installing for dependencies: php-cli i386 5.1.6-15.el5 updates 2.3 M php-common i386 5.1.6-15.el5 updates 140 k Transaction Summary ============================================================================= Install 4 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 4.6 M Downloading Packages: (1/4): php-common-5.1.6-1 100% |=========================| 140 kB 00:00 (2/4): php-mbstring-5.1.6 100% |=========================| 968 kB 00:00 (3/4): php-5.1.6-15.el5.i 100% |=========================| 1.2 MB 00:00 (4/4): php-cli-5.1.6-15.e 100% |=========================| 2.3 MB 00:02 Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: php-common ######################### [1/4] Installing: php-cli ######################### [2/4] Installing: php-mbstring ######################### [3/4] Installing: php ######################### [4/4] Installed: php.i386 0:5.1.6-15.el5 php-mbstring.i386 0:5.1.6-15.el5 Dependency Installed: php-cli.i386 0:5.1.6-15.el5 php-common.i386 0:5.1.6-15.el5 Complete! |
設定ファイルを編集する
Apacheの設定ファイルを編集 # vi /etc/httpd/conf/httpd.conf ServerTokens Prod ← 44行目前後 ServerAdmin webmaster@ns.sumserv.dip.jp ← 250行目前後 ServerName sumserv.dip.jp:80 ← 265行目前後 Options Includes ExecCGI FollowSymLinks ← 320行目前後 AllowOverride All ← 327行目前後 HostnameLookups On ← 444行目前後 LogFormat "%h %l %u %t "%!414r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined ← 485行目前後 SetEnvIf Request_URI "default.ida" no_log ← 514行目前後 追加 SetEnvIf Request_URI "cmd.exe" no_log ← 515行目前後 追加 SetEnvIf Request_URI "root.exe" no_log ← 516行目前後 追加 SetEnvIf Request_URI "Admin.dll" no_log ← 517行目前後 追加 SetEnvIf Request_URI "NULL.IDA" no_log ← 518行目前後 追加 SetEnvIf Remote_Addr 192.168.254 no_log ← 519行目前後 追加 SetEnvIf Remote_Addr 127.0.0.1 no_log ← 520行目前後 追加 CustomLog logs/access_log combined env=!no_log ← 521行目前後 ServerSignature Off ← 531行目前後 Options MultiViews ← 549行目前後 Indexes を削除 #AddDefaultCharset UTF-8 ← 745行目前後 コメントアウト 文字化け対策 AddHandler cgi-script .cgi .pl ← 785行目前後 ↓はいらないかもしれないですが、日本語のホームページなので ja を先頭に持ってくる AddLanguage ja .ja ← 704行目前後 LanguagePriority ja en ca cs da de el eo es et fr he hr it ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW ← 738行目前後 ※変更箇所だけ抜粋しています。 PHPの日本語文字化け対策 # vi /etc/php.ini output_buffering = Off ← 160行目前後 output_handler = mb_output_handler ← 175行目前後 expose_php = Off ← 307行目前後 mbstring.language = Japanese 1127行目前後 mbstring.internal_encoding = UTF-8 ← 1132行目前後 mbstring.http_input = pass ← 1135行目前後 mbstring.http_output = pass ← 1139行目前後 mbstring.encoding_translation = Off ← 1146行目前後 mbstring.detect_order = SJIS,EUC-JP,UTF-8,JIS,ASCII ← 1150行目前後 mbstring.substitute_character = none; ← 1154行目前後 ※変更箇所だけ抜粋しています。 ;(セミコロン)でコメントアウトされていたら解除する。 初期のテストページを削除 # rm -f /etc/httpd/conf.d/welcome.conf # rm -f /var/www/error/noindex.html perlのリンクを作成 # ln -s /usr/bin/perl /usr/local/bin/perl WEB用トップディレクトリのユーザー情報を管理者に変更 # chown server. /var/www/html/ HTTPサーバー起動 # /etc/rc.d/init.d/httpd start httpd を起動中: [ OK ] # chkconfig httpd on |
Comments are closed.
