1 views
実現する機能
Webサーバー(Apache)はInternet Explorer等のブラウザから自宅サーバーのWebページをみれるようにするためのサーバーです。
Webサーバーの導入手順
(1)以下の黒背景部分はGNOME端末を表示しています。紫色はキーボードから入力するコマンド(コピペした方が楽ですが、コマンドは覚えられません)、緑はコマンドや処理内容の説明、白は自動表示する部分、赤は注意書きです。
#Apacheのインストール [root@ufuso ~]# yum -y install httpd インストール: httpd.x86_64 0:2.4.6-67.el7.centos.6 依存性関連をインストールしました: httpd-tools.x86_64 0:2.4.6-67.el7.centos.6 mailcap.noarch 0:2.1.41-2.el7 完了しました! #phpのインストール [root@ufuso ~]# yum -y install php php-mbstring php-pear インストール: php.x86_64 0:5.4.16-42.el7 php-mbstring.x86_64 0:5.4.16-42.el7 php-pear.noarch 1:1.9.4-21.el7 依存性関連をインストールしました: libxslt.x86_64 0:1.1.28-5.el7 libzip.x86_64 0:0.10.1-8.el7 php-cli.x86_64 0:5.4.16-42.el7 php-common.x86_64 0:5.4.16-42.el7 php-process.x86_64 0:5.4.16-42.el7 php-xml.x86_64 0:5.4.16-42.el7 完了しました! |
(2)Webサーバー設定
#httpd設定ファイル編集 [root@ufuso ~]# vi /etc/httpd/conf/httpd.conf #エラーページ等に表示される管理者メールアドレスを指定ufuso.dip.jpは例示) ServerAdmin webmaster@ufuso.dip.jp #を削除してサーバー名を指定(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. # #Indexesを削除してファイルの一覧表示を防ぎ、Includes ExecCGIを追記して CGI,SSIを許可 Options Includes ExecCGI FollowSymLinks # # 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 # #Noneを Allに変えて、.htaccessの許可 AllowOverride All # # The following directives define some format nicknames for use with # a CustomLog directive (see below). # #長すぎるURI(414エラー)はログに記録しない LogFormat "%h %l %u %t "%!414r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined # # If you prefer a logfile with access, agent, and referer information # (Combined Logfile Format) you can use the following directive. # #wormのアクセスを記録せず SetEnvIf Request_URI "default.ida" no_log #wormのアクセスを記録せず SetEnvIf Request_URI "cmd.exe" no_log #wormのアクセスを記録せず SetEnvIf Request_URI "root.exe" no_log SetEnvIf Request_URI "Admin.dll" no_log #wormのアクセスを記録せず SetEnvIf Request_URI "NULL.IDA" no_log #内部のアクセスを記録せず 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 #行頭の#を削除して有効にし、CGIスクリプトに.plを追加 AddHandler cgi-script .cgi .pl #行頭に#を付けて、無効にする #AddDefaultCharset UTF-8 #最終行に追記。OSをProdに変えてエラーページ等でOS名を表示しないようにする ServerTokens Prod #最終行に追記。OffをOnに変えて接続が切れていないか定期的にチェックする KeepAlive On |
コメントを残す