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__) . "https://wordpress.stackexchange.com/"); /** 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/"
That’s it!