Hello! I applied for a droplet on mastodon and it worked very well. Is it possible for me to add a Wordpress on it and make it work on my subdomain? If so, how? Thank you!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @tanzeninspace,
The Mastodon MarketPlace droplet comes with Nginx and Postgres SQL. The Nginx part is pretty straight forward however the SQL one - Postgres is not. Having said that, there are certain ways to do so.
Firstly, you’ll need to create an Nginx configuration file for your new domain. If you are uncertain how to do so, I’ll recommend using the following DigitalOcean tutorial:
As for the Postgres SQL part by default WordPress supports only MySQL and MariaDB. Having said that, there is a way to actually go around it, will use the Fork version of PG4WP. You’ll need to do something like the following (after you’ve added your Nginx configuration and pointed your domain to your droplet):
Create Database and User in your PostgreSQL
sudo su - postgres
psql
create database your_database;
create user your_user with password ‘your_password’;
grant all privileges on database your_database to your_user;
\q
Download WordPress
cd /var/www/WebsiteRootDirectory
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
rm -rf latest.tar.gz
Download and configure the Fork version of WP4PG in your WordPress directory
cd wp-content // go to wp-content
git clone https://github.com/kevinoid/postgresql-for-wordpress.git
mv postgresql-for-wordpress/pg4wp Pg4wp
rm -rf postgresql-for-wordpress
cp Pg4wp/db.php db.php
Configure the wp-config.php
/** The name of the database for WordPress */
define('DB_NAME', 'your PostgreSQL database name will go here');
/** MySQL database username */
define('DB_USER', 'your PostgreSQL database username will go here');
/** MySQL database password */
define('DB_PASSWORD', 'your PostgreSQL database password will go here');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Run the Install Script
Point a web browser to start the installation script. If you placed the WordPress files in the root directory, you should visit: http://example.com/wp-admin/install.php If you placed the WordPress files in a subdirectory called blog, for example, you should visit: http://example.com/blog/wp-admin/install.php
Having said all of that, before actually starting this process, make sure to have a backup of your droplet!
Another thing, this is a workaround. In a perfect environment, I wouldn’t recommend using it and just create a new droplet.
Regards, KFSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.