Using Flex Clouds for when WP is Required
There are two ways to install WordPress in a Flex Cloud. The Traditional Way gets you a very basic WordPress installation. The recommended way installs Composer and wp-cli, a command line tool that makes setting up WordPress correctly with common and recommended plug-ins more convenient.
Friendly URLs for WordPress should work out of the box in MODX Cloud, but you may need to edit your nginx web rules depending on where you wish it installed. See examples 14 and 15 on our Web Rules user guide page.
Use wp-cli for Added Options
Installing via wp-cli lets you do many things WP-related when logged into the command line:
Create a new Flex Cloud instance for your WordPress site. Make note of the internal Cloud URL, which looks something like cNNN.paas1.tx.modxcloud.com. You will also need the database credentials in the steps below.
After your Cloud has been created, open your terminal, shell or Putty to login via
sshinto your new Flex Cloud instance and change directories into your web root:
Download and install wp-cli (you’ll get Composer, too):
curl http://modx.co/scripts/install.sh | sh
Install WP via wp-cli into a subfolder of webroot called
/wp, modifying the relevant instance, paths and connection details, as appropriate. To install into webroot, the paths would be only "/www":
wp core download --path="/www/wp" wp core config --dbhost=127.0.0.1 --dbname=instance_c9999_flex --dbuser=c9999 --dbpass=xxxxxxxxxx --dbprefix=wp_ --path="/www/wp" wp core install --path="/www/wp" --title="Hello WP!" --admin_user="your-username" --admin_password="please-put-something-secure-here" --admin_email="email@example.com" --url="https://c9999.paas1.abc.modxcloud.com/wp"
You further use wp-cli to install caching and SEO plugins that most WP sites should use, like W3 Total Cache, Yoast SEO, Login Lockdown, WP Mail SMTP (so you can use an ESP for better email deliverability) and Export Plus (for easier migrations to Revo!):
wp plugin install w3-total-cache wp plugin install wordpress-seo wp plugin install login-lockdown wp plugin install wp-mail-smtp wp plugin install export-plus
You can also use wp-cli to add admin users to your installation:
wp user create username firstname.lastname@example.org --role=administrator
The Traditional Way
Alternately, you can install WordPress the old fashioned way.
sshinto your Flex Cloud instance and grab WP from the source:
cd www curl -J -L https://wordpress.org/latest.tar.gz -o ./wp.tar.gz
To install into webroot:
tar zxvf wp.tar.gz -C ./
Alternately, to install into
tar zxvf wp.tar.gz cd wp
Setup the WordPress config file:
mv wp-config-sample.php wp-config.php nano wp-config.php
Fill in your database credentials from your Cloud Dashboard et viola!
Visit your web root to complete the WP installation.