Skip to content

Editing the wp-config.php file in Non-Bitnami Lightsail Wordpress blueeprint

0

I need to edit the wp-config.php but I cannot locate it as its not within the Worpress HTML folder. Can you provide the path to this folder to access it using SSH?

asked a month ago64 views
2 Answers
1

Hello.

I launched WordPress on Lightsail using my AWS account and searched for the files.
I confirmed that they were located in the "/var/www/" directory.

admin@ip-172-26-12-119:/var/www$ ls -la
total 16
drwxrwsr-x  3 admin www-data 4096 Apr 21 14:27 .
drwxr-xr-x 12 root  root     4096 Feb 18 09:04 ..
drwxrwsr-x  5 admin www-data 4096 Feb 18 09:05 html
-r--r-----  1 admin www-data 3930 Apr 21 14:27 wp-config.php

By the way, reading WordPress's "wp-load.php" file will tell you the order in which config files are loaded.
Specifically, the following process is described, and it can be seen that the directory one level up is also being read.

 * If neither set of conditions is true, initiate loading the setup process.
 */
if ( file_exists( ABSPATH . 'wp-config.php' ) ) {

        /** The config file resides in ABSPATH */
        require_once ABSPATH . 'wp-config.php';

} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {

        /** The config file resides one level above ABSPATH but is not part of another installation */
        require_once dirname( ABSPATH ) . '/wp-config.php';

} else {

        // A config file doesn't exist.
EXPERT
answered a month ago
EXPERT
reviewed a month ago
0

Based on the information available for Bitnami-based WordPress instances in Lightsail, the wp-config.php file is typically located at /opt/bitnami/wordpress/wp-config.php.

However, you mentioned you're using a Non-Bitnami WordPress blueprint, which would have a different file structure. For non-Bitnami WordPress installations, the wp-config.php file is commonly located in one of these paths:

  • /var/www/html/wp-config.php (most common for standard WordPress installations)
  • /home/bitnami/htdocs/wp-config.php
  • The root directory of your WordPress installation

To locate the file, you can connect via SSH and use the following command to search for it:

sudo find / -name wp-config.php

This will search your entire system and return the exact path where the wp-config.php file is located. Once you find it, you can edit it using a text editor like vim or nano.

Before making any changes, it's recommended to create a backup of the file first using a command like:

sudo cp /path/to/wp-config.php /path/to/wp-config.php.backup

Replace /path/to/ with the actual path where your wp-config.php file is located.
Sources
Configure WordPress with a Lightsail content delivery network - Amazon Lightsail
Create a load balanced WordPress website

answered a month ago
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.