To set up a WordPress subdomain with a Postgres database on Forge, you can follow these steps:
-
Install the PG4WP plugin:
- Log in to your WordPress admin dashboard.
- Go to "Plugins" > "Add New."
- Search for "PG4WP" and click "Install Now" next to the plugin.
- After installation, click "Activate" to activate the plugin.
-
Configure the Postgres database details in WordPress:
- Go to "Settings" > "PG4WP" in your WordPress admin dashboard.
- Enter the Postgres database credentials, including the host, port, database name, username, and password.
- Save the settings.
-
Update the database host in the WordPress configuration:
- Connect to your server using SSH or SFTP.
- Locate the
wp-config.phpfile in the root directory of your WordPress installation. - Open the file and find the line that defines the database host. It should look like this:
define('DB_HOST', 'localhost'); - Change the value of
DB_HOSTto the IP address or hostname of your Postgres database server. For example:define('DB_HOST', 'your-postgres-server-ip'); - Save the changes to the
wp-config.phpfile.
After completing these steps, your WordPress installation should be configured to use the Postgres database. Make sure to create the necessary tables and data in the Postgres database before using your WordPress site.
If you encounter any issues during the configuration process, double-check your database credentials and ensure that the Postgres server is accessible from your WordPress server.