1 views
実現する機能
Webサーバー(Apache)はInternet Explorer等のブラウザから自宅サーバーのWebページをみれるようにするためのサーバーです。
Webサーバーの導入手順
(1)phpのインストール(phpで作成されたWordPressを自サイトで使用しているため)
[root@ufuso ~]# yum -y install php php-mbstring php-pear ← phpのインストール Installed: php.x86_64 0:5.3.3-14.el6_3 php-mbstring.x86_64 0:5.3.3-14.el6_3 php-pear.noarch 1:1.9.4-4.el6 Dependency Installed: php-cli.x86_64 0:5.3.3-14.el6_3 php-common.x86_64 0:5.3.3-14.el6_3 Complete! |
(2)Webサーバー設定
※下記httpd.confファイルが無ければ、yum -y install httpdと入力してインス
トールから始める
[root@ufuso ~]# vi /etc/httpd/conf/httpd.conf ← httpd設定ファイル編集
ServerTokens Prod ← OSをProdに変えてエラーページ等でOS名を表示しないようにする
KeepAlive On ← OffをOnに変えて接続が切れていないか定期的にチェックする
ServerAdmin webmaster@ufuso.dip.jp
← エラーページ等に表示される管理者メールアドレスを指定
ServerName ufuso.dip.jp:80 ← #を削除してサーバー名を指定
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Includes ExecCGI FollowSymLinks ← Indexesを削除してファイルの一覧
表示を防ぎ、Includes ExecCGIを追記して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 All ← Noneを Allに変えて、.htaccessの許可
#
# 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:
#
SetEnvIf Request_URI "default.ida" no_log ← wormからのアクセスをログに記録せず
SetEnvIf Request_URI "cmd.exe" no_log ← wormからのアクセスをログに記録せず
SetEnvIf Request_URI "root.exe" no_log ← wormからのアクセスをログに記録せず
SetEnvIf Request_URI "Admin.dll" no_log ← wormからのアクセスをログに記録せず
SetEnvIf Request_URI "NULL.IDA" no_log ← wormからのアクセスをログに記録せず
SetEnvIf Remote_Addr 192.168.1 no_log ← 内部からのアクセスをログに記録せず
SetEnvIf Remote_Addr 127.0.0.1 no_log ← 自ホストからのアクセスをログに記録せず
CustomLog logs/access_log combined env=!no_log ← 上記以外のアクセスをログに記録
する
ServerSignature Off ← OnをOffに変更してエラーページ等でApacheのバージョンを表示
しないようにする
<Directory "/var/www/icons">
Options MultiViews ← Indexes、FollowSymLinksを削除しiconsディレクトリ非表示
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#AddDefaultCharset UTF-8 ← 行頭に#を付けて、無効にする
AddHandler cgi-script .cgi .pl ← 行頭の#を削除して有効にし、CGIスクリプトに.pl
を追加
|
(3)Perlコマンドへ/usr/local/bin/perlでもアクセスできるようにする
[root@ufuso ~]# ln -s /usr/bin/perl /usr/local/bin/perl ← /usr/local/bin/perlから/usr/bin/perlへリンクをはる [root@ufuso ~]# whereis perl ← Perlのパスを確認 perl: /usr/bin/perl /usr/local/bin/perl /usr/share/man/man1/perl.1.gz ← Perlのパスに/usr/local/bin/perlが表示されることを確認 |
(4)Webサーバー起動
[root@ufuso ~]# /etc/rc.d/init.d/httpd start ← httpd起動 httpd を起動中: [ OK ] [root@centos ~]# chkconfig httpd on ← httpd自動起動設定 |
(6)ポート80番のOPEN
ルーター側の設定でポート80番をOPENする。
※ルーターの設定は各ルーターのマニュアルまたはメーカー別ルーターポート開放手順を参照
ポートチェック【外部からポート開放確認】で「host名」にサーバー名(例:ufuso.dip.jp)、「port番号」に80と入力して「ポートチェック」ボタン押下し、「ホスト=ufuso.dip.jp ポート=80 にアクセスできました。」と表示されることを確認。
(7)外部からのWebサーバーアクセス確認
外部からWebサーバーにアクセスできるか確認する。
[root@ufuso ~]# echo test >> /var/www/html/index.html ← テストページ作成 |
(8)firefox等のブラウザの赤枠1にサイトのURLを入力して、赤枠2の「test」が表示されればOK。
[root@ufuso ~]# rm -f /var/www/html/index.html ← テストページの削除 |
コメントを残す