Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #10 from hspencer77/lamp-wordpress-recipe

LAMP Wordpress recipe
  • Loading branch information...
commit 9e5b0e7eb4cc76afe9aac85c16cf56c2a3ed18d4 2 parents 55e16e9 + 8f8188b
@hspencer77 hspencer77 authored
Showing with 66 additions and 0 deletions.
  1. +66 −0 cloud-init/cloud-init-lamp-wordpress.config
View
66 cloud-init/cloud-init-lamp-wordpress.config
@@ -0,0 +1,66 @@
+#cloud-config
+
+apt_update: true
+
+#apt_upgrade: true
+
+packages:
+ - wordpress
+ - mysql-server
+ - apache2-mpm-prefork
+ - php5
+ - php5-mysql
+ - libapache2-mod-php5
+ - curl
+ - postfix
+ - mlocate
+
+configapache:
+ - &config_apache |
+ public_hostname=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
+ public_ipv4=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
+ cat > /etc/apache2/sites-available/wordpress <<EOF
+ <VirtualHost *:80>
+ UseCanonicalName off
+ Options All
+ ServerAdmin webmaster@localhost
+ ServerName $public_hostname
+ ServerAlias $public_ipv4
+
+ VirtualDocumentRoot /var/www/%0
+ RewriteEngine on
+ RewriteRule ^/wp-uploads/(.*)$ /var/www/wp-uploads/%{HTTP_HOST}/\$1
+
+ ErrorLog \${APACHE_LOG_DIR}/wordpress-error.log
+ LogLevel warn
+ CustomLog \${APACHE_LOG_DIR}/wordpress-access.log combined
+ </VirtualHost>
+ EOF
+ a2enmod rewrite vhost_alias
+ a2ensite wordpress
+
+configpostfix:
+ - &config_postfix |
+ public_hostname=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
+ postconf -e myhostname=$public_hostname
+ postconf -e mydestination=$public_hostname,localhost
+ echo $public_hostname > /etc/mailname
+ postfix reload
+
+configmysql:
+ - &config_mysql |
+ public_hostname=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
+ /etc/init.d/mysql restart
+ bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress $public_hostname
+ ln -s /usr/share/wordpress /var/www/$public_hostname
+
+restartapache:
+ - &restart_apache |
+ /etc/init.d/apache2 restart
+
+runcmd:
+ - [ sh, -c, *config_postfix ]
+ - [ sh, -c, *config_mysql ]
+ - [ sh, -c, *config_apache ]
+ - [ sh, -c, *restart_apache ]
+ - touch /tmp/done
Please sign in to comment.
Something went wrong with that request. Please try again.