mirror of
https://github.com/certbot/certbot.git
synced 2026-01-26 07:41:33 +03:00
25 lines
1.0 KiB
Bash
Executable File
25 lines
1.0 KiB
Bash
Executable File
#!/bin/bash -x
|
|
|
|
#install apache2 on apt systems
|
|
# debian doesn't come with curl
|
|
sudo apt-get update
|
|
sudo apt-get -y --no-upgrade install apache2 #curl
|
|
|
|
# $PUBLIC_IP $PRIVATE_IP $PUBLIC_HOSTNAME $BOULDER_URL are dynamically set at execution
|
|
# fetch instance data from EC2 metadata service
|
|
#public_host=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-hostname)
|
|
#public_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-ipv4)
|
|
#private_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/local-ipv4)
|
|
|
|
# For apache 2.4, set up ServerName
|
|
sudo sed -i '/ServerName/ s/#ServerName/ServerName/' \
|
|
/etc/apache2/sites-available/000-default.conf
|
|
sudo sed -i '/ServerName/ s/www.example.com/'$PUBLIC_HOSTNAME'/' \
|
|
/etc/apache2/sites-available/000-default.conf
|
|
|
|
# run letsencrypt-apache2 via letsencrypt-auto
|
|
cd letsencrypt
|
|
./letsencrypt-auto -v --debug --text --agree-dev-preview --agree-tos \
|
|
--renew-by-default --redirect --register-unsafely-without-email \
|
|
--domain $PUBLIC_HOSTNAME --server $BOULDER_URL
|