LoginSignup
0
0

More than 1 year has passed since last update.

AWSのEC2にApacheサーバーを設定してWebサーバーを立ち上げる(備忘録)

Last updated at Posted at 2022-04-29

Apacheサーバーのインストール

EC2サーバーにログイン後

//ルートに移動
$ sudo su

//不足しているパッケージの追加
$ yum update -y

//Apacheサーバーをインストール
$ yum install httpd -y

Apacheサーバーを立ち上げWebサーバーを設置

//Apacheサーバーの起動
$ service httpd start

//Webサーバーを立ち上げるためのディレクトリを作成
$ cd /var/www/html

//先ほど作成したディレクトリにindex.htmlを作成
$ ls
$ nano index.html

別Windowが立ち上がるので"Hello World!!"を表示させるhtmlコマンドを入力する

<html><h1>Hello World!!</h1></html>

Ctrl + x で保存すると、終了するかを確認されるので、yを押してEnterで終了する。

//Apacheサーバーを再起動
$ service httpd restart

ブラウザにEC2のパブリックIPアドレスをベタ打ちすると、先ほど作成したWebサイトが表示される。
Image from Gyazo

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0