WordPress is powerful web software that can be used to host a blog, a website, or a web application. As of 2016, it powers at least 26% of all websites. This tutorial will teach you how to deploy WordPress to CenturyLink Cloud's Platform-as-a-Service, AppFog. The process requires some knowledge of setting up WordPress and minimal PHP skills. For more information on installing and deploying WordPress on a conventional hosting platform, read the WordPress Installation Manual.

Comparing the WordPress Blueprint

CenturyLink Cloud also offers a Blueprint for deploying a fully-configured WordPress installation. The WordPress Blueprint is ideal for provisioning a production-ready system, complete with virtual servers and cloud database access. Read more about deploying a WordPress Blueprint in our the Knowledge Base article.

WordPress on AppFog is better suited for smaller installations, which ensures that AppFog deployment and management is fast and produces low-overhead. WordPress on AppFog is well-designed for developing plug-ins, testing new versions, and customizing or modifying software.

Tools Used

AppFog is our Platform-as-a-Service (PaaS) offering based on Cloud Foundry. It allows you to easily host cloud-native applications without worrying about provisioning and maintaining servers and separate services. AppFog applications deploy quickly and scale automatically while having access to the full range of CenturyLink Cloud products.

Before We Start

You’ll need access to AppFog. If you don’t have a CenturyLink Cloud account, migrate to the CenturyLink Platform with free onboarding assistance and receive a matching spend credit. The credit is based on your initial commitment period of platform use.

Configuring WordPress for Deployment

To deploy WordPress to AppFog, we need to start by configuring a local copy of the WordPress software package. Follow these steps to download and unpack WordPress.

  1. Go the the Wordpress website.
  2. Click Download WordPress to get the latest version.
  3. Unzip the downloaded package and change your path to your new working directory. The following commands works for Linux and OS X.
        $ unzip ~/Downloads/wordpress-4.4.2.zip
        $ cd wordpress/
    Note: Replace the filename in the first command with the name of the file you downloaded in Step 2.

Create the Project Manifest

A manifest file sends important configuration information to AppFog, including resource allocation and important environment variables.

  1. In your project directory, create a manifest.yaml file using your favorite text editor. Edit the file so that it looks like this:
         - name: <my-project-name>
           memory: 256M
           instances: 1
           buildpack: https://github.com/cloudfoundry/php-buildpack
             CF_STAGING_TIMEOUT: 15
             CF_STARTUP_TIMEOUT: 15
  2. Set the name attribute to your project name.

    Note: The name can’t contain any spaces, and because AppFog uses a global project namespace, the name needs to be unique across the entire AppFog project. For example, you might consider using your initials or organization's name.

Creating a Buildpack Configuration

Buildpacks provide framework and runtime support for AppFog applications. Since WordPress is a PHP application, your project will use the PHP buildpack. This includes PHP, Apache HTTPD, and other essential support programs. The next step is to configure the PHP buildpack.

  1. In the project directory, create a .bp-config directory by running mkdir .bp-config.
  2. Using a text editor, create .bp-config/options.json and edit the file to look like this:
          "WEB_SERVER": "httpd",
          "WEBDIR": "/",
          "PHP_VERSION": "5.6.19",
          "PHP_EXTENSIONS": [ "curl", "gd", "mbstring", "mcrypt", "openssl", "mysqli",
                              "soap", "xsl", "zip" ]

Deploying WordPress to AppFog

Now you need to configure AppFog in your CenturyLink Cloud account and deploy WordPress without starting the application. For a good understanding of AppFog, read the Getting Started Guide. The following directions get you up and running quickly.

Enable AppFog

First, enable AppFog in the CenturyLink Cloud Control Portal.

  1. Go to the Control Portal and sign in.
  2. Select AppFog from the pull-down menu. wlueprint
  3. Select a host region for your application. Control Panel

Log into AppFog Using the Cloud Foundry Tools

Once AppFog is set up in your CenturyLink Cloud account, log in to AppFog using the Cloud Foundry CLI. The Control Portal gives you an exact command on the Overview tab.

  1. Find the cf login command on your AppFog Control Panel. It will look similar to this:p
        cf login -a https://api.useast.appfog.ctl.io -o C007 -u <your.username>
    Login Panel
  2. Run the cf login command in your project directory.
  3. Enter your CenturyLink Cloud password when prompted. Password
  4. At the "Space>" prompt, select the Dev application space. Dev App Space

    Note: To learn more about logging into AppFog using the Cloud Foundry command-line tools, read this Knowledge Base article.

Deploy WordPress Without Starting It

After the initial configuration and login, deployment is just one command.

  1. Run the following command in your project directory.
        $ cf push --random-route --no-start
  2. Record the URL of your application for later use.

    A successful deployment produces a lot of output that looks similar to this when finished: Success

Creating a CenturyLink MySQL service

Before finishing your WordPress configuration, we need to create a CenturyLink MySQL service and bind it to your AppFog project.

  1. Create a MySQL service and bind it to your AppFog application by running the following commands in your project directory.
        $ cf create-service ctl_mysql mysql_single <your-database-name>
        $ cf bind-service <your-app-name> <your-database-name>
  2. Replace <your-database-name> and <your-app-name> with the name of your AppFog application and database name.

  3. Find your MySQL configuration and authentication information using the cf env command.

        $ cf env <your-project-name>
         "VCAP_SERVICES": {
          "ctl_mysql": [
            "credentials": {
             "certificate": "-----BEGIN CERTIFICATE-----{...}-----END CERTIFICATE-----",
             "dbname": "{database name}",
             "hostname": "{hostname}",
             "password": "{password}",
             "port": {port},
             "username": "{username}"
            "label": "ctl_mysql",
            "name": "<your-database-name>",
            "plan": "micro",
            "tags": []
  4. Record the database name, hostname, password, port, and username for configuring WordPress in the next step.

For more information on using CenturyLink MySQL with AppFog applications, read this Knowledge Base article.

Configuring WordPress

  1. In your working directory, create a new WordPress configuration file with this command:
        $ cp wp-config-sample.php wp-config.php
  2. Open wp-config.php using a text editor.
  3. Find the line containing "MySQL settings". Directly below that are a number of configuration options:
  4. Replace "database_name_here" with "default".
  5. Replace "username_here" and "password_here" with the username and password you recorded in the previous section.
  6. Replace "localhost" with a string containing the hostname and port you recorded in the previous section. Joined them by a colon ":". For example, if hostname is db45.uc1.rdbs.ctl.io and port is 3687, replace localhost with db45.uc1.rdbs.ctl.io:3687.
  7. Find the configuration section labeled Authentication Unique Keys and Salts and replace the keys and salts with new ones generated at this link: https://api.wordpress.org/secret-key/1.1/salt/

Deploying and Starting WordPress

WordPress is now ready to run.

  1. Deploy and start running WordPress with the following command.
        $ cf push
    The command should produce output similar to this: Droplet

Final WordPress Configuration

WordPress is ready to run through its setup wizard. Go to the URL indicated in the cf push command from the previous step and follow the instructions on the screen.

Additional Resources on WordPress

You may be interested in looking at the follow WordPress articles too.


WordPress is an open-source project great for hosting blog, web site, and web applications. Wordpress has grown into a robust user-driven Content Management System (CMS) used today by over 26% of the top 10 million websites. Deploying that technology in AppFog is now easier than ever.

Sign-up for our Developer-focused newsletter CODE. Designed hands-on by developers, for developers. Keep up to date on topics of interest: tutorials, tips and tricks, and community building events.

We’re a different kind of cloud provider – let us show you why.