mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 00:22:04 +02:00
fixed apache2 script, tested on centos7
This commit is contained in:
+2
-2
@@ -123,8 +123,8 @@ def make_instance(instance_name,
|
|||||||
UserData=userdata,
|
UserData=userdata,
|
||||||
InstanceType=machine_type)[0]
|
InstanceType=machine_type)[0]
|
||||||
|
|
||||||
# brief pause to prevent rare EC2 error
|
# brief pause to prevent rare error on EC2 delay, should block until ready instead
|
||||||
time.sleep(0.5)
|
time.sleep(1.0)
|
||||||
|
|
||||||
# give instance a name
|
# give instance a name
|
||||||
new_instance.create_tags(Tags=[{'Key': 'Name', 'Value': instance_name}])
|
new_instance.create_tags(Tags=[{'Key': 'Name', 'Value': instance_name}])
|
||||||
|
|||||||
+11
-17
@@ -1,15 +1,7 @@
|
|||||||
#!/bin/bash -x
|
#!/bin/bash -x
|
||||||
|
|
||||||
#install apache2 on apt systems
|
# $OS_TYPE $PUBLIC_IP $PRIVATE_IP $PUBLIC_HOSTNAME $BOULDER_URL
|
||||||
# debian doesn't come with curl
|
# are dynamically set at execution
|
||||||
#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)
|
|
||||||
|
|
||||||
if [ $OS_TYPE = "ubuntu" ]
|
if [ $OS_TYPE = "ubuntu" ]
|
||||||
then
|
then
|
||||||
@@ -22,22 +14,24 @@ then
|
|||||||
elif [ $OS_TYPE = "centos" ]
|
elif [ $OS_TYPE = "centos" ]
|
||||||
then
|
then
|
||||||
CONFFILE=/etc/httpd/conf/httpd.conf
|
CONFFILE=/etc/httpd/conf/httpd.conf
|
||||||
|
sudo setenforce 0 || true #disable selinux
|
||||||
sudo yum -y install httpd
|
sudo yum -y install httpd
|
||||||
sudo service httpd start
|
sudo service httpd start
|
||||||
sudo mkdir -p /var/www/$PUBLIC_HOSTNAME/public_html
|
sudo mkdir -p /var/www/$PUBLIC_HOSTNAME/public_html
|
||||||
sudo chmod -R 777 /var/www
|
sudo chmod -R oug+rwx /var/www
|
||||||
sudo echo '<html><head><title>foo</title></head>\n<body>bar</body></html>' > /var/www/$PUBLIC_HOSTNAME/public_html/index.html
|
sudo chmod -R oug+rw /etc/httpd
|
||||||
sudo mkdir /etc/httpd/sites-available
|
sudo echo '<html><head><title>foo</title></head><body>bar</body></html>' > /var/www/$PUBLIC_HOSTNAME/public_html/index.html
|
||||||
sudo mkdir /etc/httpd/sites-enabled
|
sudo mkdir /etc/httpd/sites-available #letsencrypt requires this...
|
||||||
sudo echo "IncludeOptional sites-enabled/*.conf" >> /etc/httpd/conf/httpd.conf
|
sudo mkdir /etc/httpd/sites-enabled #letsencrypt requires this...
|
||||||
|
#sudo echo "IncludeOptional sites-enabled/*.conf" >> /etc/httpd/conf/httpd.conf
|
||||||
sudo echo """
|
sudo echo """
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName $PUBLIC_HOSTNAME
|
ServerName $PUBLIC_HOSTNAME
|
||||||
DocumentRoot /var/www/$PUBLIC_HOSTNAME/public_html
|
DocumentRoot /var/www/$PUBLIC_HOSTNAME/public_html
|
||||||
ErrorLog /var/www/$PUBLIC_HOSTNAME/error.log
|
ErrorLog /var/www/$PUBLIC_HOSTNAME/error.log
|
||||||
CustomLog /var/www/$PUBLIC_HOSTNAME/requests.log combined
|
CustomLog /var/www/$PUBLIC_HOSTNAME/requests.log combined
|
||||||
</VirtualHost>""" >> /etc/httpd/sites-available/$PUBLIC_HOSTNAME.conf
|
</VirtualHost>""" >> /etc/httpd/conf.d/$PUBLIC_HOSTNAME.conf
|
||||||
sudo cp /etc/httpd/sites-available/$PUBLIC_HOSTNAME.conf /etc/httpd/sites-enabled/
|
#sudo cp /etc/httpd/sites-available/$PUBLIC_HOSTNAME.conf /etc/httpd/sites-enabled/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run letsencrypt-apache2 via letsencrypt-auto
|
# run letsencrypt-apache2 via letsencrypt-auto
|
||||||
|
|||||||
+13
-39
@@ -33,28 +33,28 @@ targets:
|
|||||||
type: ubuntu
|
type: ubuntu
|
||||||
virt: hvm
|
virt: hvm
|
||||||
user: admin
|
user: admin
|
||||||
userdata: |
|
# userdata: |
|
||||||
#cloud-init
|
# #cloud-init
|
||||||
runcmd:
|
# runcmd:
|
||||||
- [ apt-get, install, -y, curl ]
|
# - [ apt-get, install, -y, curl ]
|
||||||
- ami: ami-e0efab88
|
- ami: ami-e0efab88
|
||||||
name: debian7.8.aws.1
|
name: debian7.8.aws.1
|
||||||
type: ubuntu
|
type: ubuntu
|
||||||
virt: hvm
|
virt: hvm
|
||||||
user: admin
|
user: admin
|
||||||
userdata: |
|
# userdata: |
|
||||||
#cloud-init
|
# #cloud-init
|
||||||
runcmd:
|
# runcmd:
|
||||||
- [ apt-get, install, -y, curl ]
|
# - [ apt-get, install, -y, curl ]
|
||||||
- ami: ami-e6eeaa8e
|
- ami: ami-e6eeaa8e
|
||||||
name: debian7.8.aws.1_32bit
|
name: debian7.8.aws.1_32bit
|
||||||
type: ubuntu
|
type: ubuntu
|
||||||
virt: pv
|
virt: pv
|
||||||
user: admin
|
user: admin
|
||||||
userdata: |
|
# userdata: |
|
||||||
cloud-init
|
# #cloud-init
|
||||||
runcmd:
|
# runcmd:
|
||||||
- [ apt-get, install, -y, curl ]
|
# - [ apt-get, install, -y, curl ]
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Other Redhat Distros
|
# Other Redhat Distros
|
||||||
- ami: ami-60b6c60a
|
- ami: ami-60b6c60a
|
||||||
@@ -62,41 +62,21 @@ targets:
|
|||||||
type: centos
|
type: centos
|
||||||
virt: hvm
|
virt: hvm
|
||||||
user: ec2-user
|
user: ec2-user
|
||||||
userdata: |
|
|
||||||
#cloud-config
|
|
||||||
runcmd:
|
|
||||||
- yum -y install httpd
|
|
||||||
- service httpd start
|
|
||||||
- ami: ami-0d4cfd66
|
- ami: ami-0d4cfd66
|
||||||
name: amazonlinux-2015.03.1
|
name: amazonlinux-2015.03.1
|
||||||
type: centos
|
type: centos
|
||||||
virt: hvm
|
virt: hvm
|
||||||
user: ec2-user
|
user: ec2-user
|
||||||
userdata: |
|
|
||||||
#cloud-config
|
|
||||||
runcmd:
|
|
||||||
- yum -y install httpd
|
|
||||||
- service httpd start
|
|
||||||
- ami: ami-a8d369c0
|
- ami: ami-a8d369c0
|
||||||
name: RHEL7
|
name: RHEL7
|
||||||
type: centos
|
type: centos
|
||||||
virt: hvm
|
virt: hvm
|
||||||
user: ec2-user
|
user: ec2-user
|
||||||
userdata: |
|
|
||||||
#cloud-config
|
|
||||||
runcmd:
|
|
||||||
- yum -y install httpd
|
|
||||||
- service httpd start
|
|
||||||
- ami: ami-518bfb3b
|
- ami: ami-518bfb3b
|
||||||
name: fedora23
|
name: fedora23
|
||||||
type: centos
|
type: centos
|
||||||
virt: hvm
|
virt: hvm
|
||||||
user: fedora
|
user: fedora
|
||||||
userdata: |
|
|
||||||
#cloud-config
|
|
||||||
runcmd:
|
|
||||||
- yum -y install httpd
|
|
||||||
- service httpd start
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# CentOS
|
# CentOS
|
||||||
# These Marketplace AMIs must, irritatingly, have their terms manually
|
# These Marketplace AMIs must, irritatingly, have their terms manually
|
||||||
@@ -106,11 +86,6 @@ targets:
|
|||||||
type: centos
|
type: centos
|
||||||
virt: hvm
|
virt: hvm
|
||||||
user: centos
|
user: centos
|
||||||
userdata: |
|
|
||||||
#cloud-config
|
|
||||||
runcmd:
|
|
||||||
- yum -y install httpd
|
|
||||||
- service httpd start
|
|
||||||
# centos6 requires EPEL repo added
|
# centos6 requires EPEL repo added
|
||||||
- ami: ami-57cd8732
|
- ami: ami-57cd8732
|
||||||
name: centos6
|
name: centos6
|
||||||
@@ -120,6 +95,5 @@ targets:
|
|||||||
userdata: |
|
userdata: |
|
||||||
#cloud-config
|
#cloud-config
|
||||||
runcmd:
|
runcmd:
|
||||||
- yum install -y epel-release httpd
|
- yum install -y epel-release
|
||||||
- service httpd start
|
|
||||||
- iptables -F
|
- iptables -F
|
||||||
|
|||||||
Reference in New Issue
Block a user