siteurl and home url options under the Settings tab in the admin. This meant we would have to do a little hacking.
Fortunately there is one central function that handles pulling of options from the database. All we have to do is add one line in there to check if we are running on port 81 and hard code our value in there. Yes hard coding is not the cleanest way to do it, but technically are url is hard coded in the db anyway.
So lets open up the functions.php file from WordPress.
$ vi /path/to/wordpress/wp-includes/functions.phpInside this file you will see some code like so:
function get_option( $option, $default = false ) {
....
return apply_filters( 'option_' . $option, maybe_unserialize( $value ) );
}
All we need to do is modify the value before the return by checking if the option is either home or siteurl and on the alternate port we are running WordPress on, which in this case is port 81.
function get_option( $option, $default = false ) {
....
if(($option == 'siteurl' || $option == 'home') && $_SERVER['SERVER_PORT'] == '81')
$value = 'http://www.duchnik.com:81/tutorials';
return apply_filters( 'option_' . $option, maybe_unserialize( $value ) );
}
We can go on adding multiple conditional statements here for other ports as well if we liked. Also I could get a little fancier here by parsing the original siteurl and home url options already in the db, then use that to reconstruct the url with the new port, but didn’t find that necessary for the time being.
WordPress MySQL Setup CommandsGetting WordPress to Work with Nginx
Install and Configure Nginx on CentOS
Install and Configure Apache on CentOS
Install PHP on CentOS
Install and Configure MySQL on CentOS