AWSメモ >

EC2にApacheをインストール

ここでは以下の作業を行う。

apacheインストール

sudo yum -y install httpd
sudo service httpd start

自動起動の設定

https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/SSL-on-an-instance.html

sudo systemctl start httpd && sudo systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

mod_sslインストール

sudo yum update -y
sudo yum install -y mod_ssl

自己証明書の作成

# サーバ鍵の作成
sudo sh -c "openssl genrsa 2048 > /etc/httpd/conf/sample.hogehoge.com-server.key"

# 証明書要求の作成
sudo sh -c "openssl req -new -key /etc/httpd/conf/sample.hogehoge.com-server.key > /etc/httpd/conf/sample.hogehoge.com-server.csr"

# 自己署名して証明書を作成
openssl x509 -req -signkey /etc/httpd/conf/sample.hogehoge.com-server.key < /etc/httpd/conf/sample.hogehoge.com-server.csr > sample.hogehoge.com-server.crt
sudo mv sample.hogehoge.com-server.crt /etc/httpd/conf/

作成した証明書をapacheの設定ファイルに記述

sudo vim /etc/httpd/conf.d/ssl.conf
SSLCertificateFile /etc/httpd/conf/sample.hogehoge.com-server.crt
SSLCertificateKeyFile /etc/httpd/conf/sample.hogehoge.com-server.key

再起動

sudo service httpd restart

トップ   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS