SaeK
SaeK

Reputation: 19

AWS EC2( Apache) cannot be configured for SSL with Cerbot

I have successfully deployed an application created in Laravel to AWS EC2 (Apache) and display it over HTTP. However, I have configured it using Cerbot to display it over HTTPS, but it is not displaying.

The work I have done is as follows

$ sudo wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/
$ sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm
$ sudo yum-config-manager --enable epel*
$ sudo yum repolist all

I opened /etc/httpd/conf/httpd.conf and added the following information

Listen 80

<VirtualHost *:80>
DocumentRoot "/var/www/html/app_name/public"
ServerName "example.com"
ServerAlias "www.example.com"
</VirtualHost>

Include /etc/httpd/conf/httpd-le-ssl.conf

I then restarted Apache and installed Cerbot.

$ sudo systemctl restart httpd
$ sudo yum install -y certbot python2-certbot-apache
$ sudo certbot

You have answered Certbot's questions and received the message "Congratulations! You have successfully enabled https://example.com."

However, it is not actually displayed over https.

/etc/httpd/conf/httpd-le-ssl.conf is as follows.

<IfModule mod_ssl.c>
<VirtualHost *:443>
DocumentRoot "/var/www/html/app_name/public"
ServerName "online-study-room.jp"
ServerAlias "www.online-study-room.jp"
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/online-study-room.jp/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/online-study-room.jp/privkey.pem
</VirtualHost>
</IfModule>

Any help would be greatly appreciated. Thank you for reading.

Upvotes: 0

Views: 97

Answers (1)

SaeK
SaeK

Reputation: 19

Port 443 was not open in the EC2 inbound rules.

Upvotes: 1

Related Questions