Linux(CentOS 7)でWebサーバーの構築 ~Apache編~
① httpd のインストール
# ウェルカムページを削除
② httpd の設定
例) http://www.trompot.nara/ で80/TCPを使用する場合
[root@localhost ~]# vi /etc/httpd/conf/httpd.conf
ServerAdmin root@trompot.nara # 86行目:管理者アドレス指定
ServerName www.trompot.nara:80 # 95行目:サーバー名指定
AllowOverride All # 151行目:変更
DirectoryIndex index.html index.cgi index.php # 164行目:追記
# 以下を最終行に追記
ServerTokens Prod # サーバーの応答ヘッダ
KeepAlive On # キープアライブオン
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
③ テストページ作成
[root@localhost ~]# vi /var/www/html/index.html
<!doctype html><html lang="ja">
<body>
<div style="width: 100%; font-size: 50px; font-weight: bold; text-align: center;">テストページ index.html
</div>
</body>
</html>
LAN上のデバイスからは「サーバー名」ではなく「サーバーのローカルIPアドレス」をでアクセスしてください。
以上です。
次回、SSLの導入を予定しております。