OCIでメールサーバー構築ーその3 Webサーバー構築
sudo yum -y install httpd
Remiをインストールしてyum更新
sudo yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
sudo yum update
php7.3をインストール
sudo yum -y install --enablerepo=epel,remi,remi-php73 php php-devel php-mbstring php-pdo php-mysqli php-mysqlnd php-mcrypt php-imap
動作検証1.apache
sudo systemctl start httpd
ブラウザでhttp://***.***.***.*** を開くと以下のapacheの初期ページが表示されれば成功
テストページ削除
sudo rm -f /etc/httpd/conf.d/welcome.conf
動作検証2.PHP
sudo su
echo "<?php phpinfo(); ?>" > /var/www/html/info.php
exit
ブラウザでhttp://***.***.***.***/info.php で以下のような設定情報が表示されれば成功
テスト用に作成したphpinfoを削除。
sudo rm -f /var/www/html/info.php
Apacheの設定をしていきます。
sudo vi /etc/httpd/conf/httpd.conf
95行目くらい
#ServerName www.example.com:80
↓
ServerName testtest.pgw.jp:80
144行目くらいにExecCGIを加えてCGI実行の許可
Options Indexes FollowSymLinks
↓
Options Includes ExecCGI FollowSymLinks
150行目くらいを以下に調整して.htaccessを許可する
AllowOverride None
↓
AllowOverride All
195行目くらいを調整して長いURIはログに記録しないようにする
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
↓
LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
211行目くらいから(CustomLog logs/access_log combinedをコメントアウトしてその下あたりに)以下を追記。意味は参考サイトの方を参照
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 Remote_Addr 10.0.0 no_log
SetEnvIf Remote_Addr 127.0.0.1 no_log
CustomLog logs/access_log combined env=!no_log
301行目くらい
#AddHandler cgi-script .cgi
↓
AddHandler cgi-script .cgi .pl
323行目くらい
AddDefaultCharset UTF-8
↓
#AddDefaultCharset UTF-8
最後に以下を追記。
TraceEnable off
sudo vi /etc/httpd/conf.d/autoindex.conf
23行目くらいの<Directory "/usr/share/httpd/icons">を以下のように調整。
Options Indexes MultiViews FollowSymlinks
↓
Options MultiViews
Apache再起動して起動時に自動読込設定
sudo systemctl restart httpd
sudo systemctl enable httpd