Service: Wordpress - EyevinnOSC/community GitHub Wiki

Getting started

The WordPress open source project has evolved in progressive ways over time—supported by skilled, enthusiastic developers, designers, scientists, bloggers, and more. WordPress provides the opportunity for anyone to create and share, from handcrafted personal anecdotes to world-changing movements. This is a tutorial on how launch a WordPress powered site in Open Source Cloud.

Prerequisites

  • If you have not already done so, sign up for an OSC account.
  • Active MariaDB subscription in Open Source Cloud or a MySQL server hosted elsewhere. In this tutorial we will use the MariaDB service.

Step 1: Setup database

First thing is to setup a MySQL database and in this tutorial we will use the MySQL compatible service MariaDB available in Open Source Cloud.

Create a MariaDB database instance with the following settings. The rootpassword secret variable holds the admin password for the database and has been created in advance:

Skärmavbild 2024-10-07 kl  13 56 18

After a short while you will now have a database up and running. Copy the IP and port in the TCP field as this will be later used in this guide.

Skärmavbild 2024-10-07 kl  13 59 29

Step 2: Create Wordpress instance

Now when the database is up and running we can continue with creating a Wordpress instance. Navigate to the Wordpress service in Open Source Cloud.

Create two secrets for the database username and password that will be used.

Skärmavbild 2024-10-07 kl  14 02 38

Next step is to create the instance. Click on the button "Create wordpress" and enter the following settings:

Skärmavbild 2024-10-07 kl  14 04 41

Then press the Create button.

Step 3: Configure Wordpress site

When the instance is up and running you can click on the instance card and a new window will open where you can start to configure your Wordpress site.

Skärmavbild 2024-10-07 kl  14 06 04

And that's it. Now you have a fresh Wordpress site up and running that you can configure and publish.

Step 4: Configure CDN

It is recommended to configure a CDN for accelerated delivery and possibility to use a custom domain name.

AWS Cloudfront

In the Cloudfront service on the AWS console, click “Create Distribution”. Set the origin domain as <tenantId>-guide.wordpress-wordpress.auto.prod.osaas.io, the one you just created and where <tenantId> is the id of your tenant. Set the origin protocol policy to “HTTPS only”, to enforce only https between CloudFront and the origin (your instance in Open Source Cloud).

For the viewer behavior, set “Redirect http to https”. Allow all HTTP methods (GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE). For the Cache settings, leave the defaults. We’ll update these later. Now tap the “Create distribution” button to create your CloudFront distribution.

Create a Origin Request Policy called WordpressStatic with the following settings:

  • Headers: None
  • Cookies: None
  • Query strings: None

Create another Origin Request Policy called WordpressDynamic with the following settings:

  • Headers: Include [CloudFront-Is-Tablet-Viewer, CloudFront-Forwarded-Proto, CloudFront-Is-Mobile-Viewer, CloudFront-Is-Desktop-Viewer]
  • Cookies: Include [comment_*, wordpress_*, wp-settings-*]
  • Query strings: All

And the final Origin Request policy called WordpressDynamicAdmin with these settings:

  • Headers: Include [CloudFront-Is-Tablet-Viewer, CloudFront-Forwarded-Proto, CloudFront-Is-Mobile-Viewer, CloudFront-Is-Desktop-Viewer]
  • Cookies: All
  • Query strings: All

Then we will create a Cache Policy we call WordpressDynamicContent with these settings:

  • Minimum TTL: 60
  • Default TTL: 60
  • Maximum TTL: 60
  • Headers: Include [CloudFront-Is-Tablet-Viewer, CloudFront-Forwarded-Proto, CloudFront-Is-Mobile-Viewer, CloudFront-Is-Desktop-Viewer, Authorization, X-WP-Nonce]
  • Cookies: Include [comment_*, wordpress_*, wp-settings-*]
  • Query strings: All

What is important is to not forward Host header to the origin.

Then assign these policies according to the screenshot below:

Skärmavbild 2024-10-07 kl  23 46 54

⚠️ **GitHub.com Fallback** ⚠️