(CentOS7,Apache)Webサーバを構築

何をするか

クライアントからルータを介してWebページを閲覧する
クライアント : CentOS7
サーバ : CentOS7
ルータ : CiscoC7200
↓ざっくり構成図

手順

(サーバ)Apacheをインストール

サーバをインターネットに繋いでapacheとphp関連のパッケージをインストール #Completeと表示されればインストール完了

[root@osboxes ~]# yum -y install httpd php php-mbstring

Apacheの起動、自動起動設定

[root@osboxes ~]# systemctl start httpd
[root@osboxes ~]# systemctl enable httpd

トップページを編集、「hello web!」とだけ記述
viの使い方 → GOGO !

[root@osboxes ~]# vi /var/www/html/index.html

(ルータ)Configを作成

ルーターへコンフィグを投入

Cisco7200150-1M-1#conf t
Cisco7200150-1M-1(config)#int gi 2/0
Cisco7200150-1M-1(config-if)#no shutdown
Cisco7200150-1M-1(config-if)#ip address 172.16.1.254 255.255.255.0
Cisco7200150-1M-1(config-if)#int gi 1/0
Cisco7200150-1M-1(config-if)#no shutdown
Cisco7200150-1M-1(config-if)#ip address 192.168.10.254 255.255.255.0

(クライアント)疎通、動作確認

疎通確認

[client@osboxes ~]# ping 172.16.1.1
PING 172.16.1.1 (172.16.1.1) 56(84) bytes of data.
64 bytes from 172.16.1.1: icmp_seq=1 ttl=63 time=20.8 ms
64 bytes from 172.16.1.1: icmp_seq=2 ttl=63 time=11.7 ms

clientのブラウザで問題なく見れた!!