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 c****.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
ssh
into your new Flex Cloud instance and change directories into your web root:cd www
-
Download and install wp-cli (you’ll get Composer, too):
sh -c "$(curl https://modx.co/scripts/install.sh)"
-
Install WP via wp-cli into webroot: "/www":
wp core download wp core config --dbhost=127.0.0.1 --dbname=instance_c**** --dbuser=c**** --dbpass=xxxxxxxxxx --dbprefix=wp_ wp core install --title="Hello WP!" --admin_user="your-username" --admin_password="please-put-something-secure-here" --admin_email="you@example.com" --url="https://c9999.paas1.abc.modxcloud.com"
-
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 users@email.com --role=administrator
The Traditional SSH Method
Alternatively, you can install WordPress the old-fashioned way.
-
First,
ssh
into 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
/wp
: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.