Is it possible to change a setting so that wp-config.php could be moved up two directory levels (instead of the default 1 level)? This would allow the core WP files to be moved from public_html to a subdirectory, while simultaneously allowing wp-config.php to be moved above public_html and thus not publicly accessible.
Yes, there is a great example of how to accomplish this in the top answer for the question: Is moving wp-config outside the web root really beneficial?
The section titled "How to move wp-config.php to any location on your server" provides the following solution:
But what if you've moved [wp-config.php] somewhere else? Easy. Create a new wp-config.php in the WordPress directory with the following code:
<?php /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); /** Location of your WordPress configuration. */ require_once(ABSPATH . '../phpdocs/wp-config.php');
(Be sure to change the above path to the actual path of your relocated wp-config.php file.)
If you run into a problem with open_basedir, just add the new path to the open_basedir directive in your PHP configuration:
open_basedir = "/var/www/vhosts/example.com/httpdocs/;/var/www/vhosts/example.com/phpdocs/;/tmp/"