TurnKey Linux Virtual Appliance Library

Wordpress VM - both Address and Site URL are gray

Hi,

How do I modify these settings?  The WordPress Address and Site Address are both populated with the private IP address my VM is using (under Settings > General from the wp-admin page).  No where in the setup or config did I see a prompt to change these.  The boxes are both gray and I  cannot change the fields. 

The problem is some plugins use these, and they fail with the private IP.  For example, a google XML site map does not work with http://privateip/xml.  


Thanks

Alon Swartz's picture

Requires wp-config.php and database tweaks

The default configuration is to support all hostnames dynamically, but you change that in /var/www/wordpress/wp-config.php

old
---
define('WP_SITEURL', 'http://'.$_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://'.$_SERVER['HTTP_HOST']);

new
---
define('WP_SITEURL', 'http://www.yoursite.com');
define('WP_HOME', 'http://www.yoursite.com');

There is a gotcha though, as wordpress stores those values in the database. You can change them as follows:

SITE='http://www.yoursite.com'
NAME=wordpress
DB_PREFIX=wp_

mysql --defaults-extra-file=/etc/mysql/debian.cnf <USE $NAME;
UPDATE ${DB_PREFIX}options SET option_value='$SITE' WHERE option_name='home';
UPDATE ${DB_PREFIX}options SET option_value='$SITE' WHERE option_name='siteurl';
EOF

Thanks I modified my

Thanks I modified my config.php.  I'm not sure on the DB side though - what's the easiest way to tweak that?

 

Thanks


Alon Swartz's picture

Just run the code...

Just run the code that I posted above to update the database, but make sure your set SITE to your domain name before you do...

Hi, I'm getting this when I

Hi,

I'm getting this when I enter this from the CLI:

 mysql --defaults-extra-file=/etc/mysql/debian.cnf <USE $NAME;
-bash: USE: No such file or directory
 


Jeremy's picture

Hmm strange.

The command should be run by MySQL not bash (hence the mysql at the start). I don't know why it's not working because I don't know much about using MySQL at the commandline. From what I can gather the line should be launching MySQL command prompt as the default debian user and loading the wordpress DB. But I just tested it myself and sure enough, it errors. This is not quite so tidy, but do this instead (assuming your domain name is www.yoursite.com):

mysql --defaults-extra-file=/etc/mysql/debian.cnf

Which should open a priveledged mysql command prompt that looks like this:

mysql>

At that prompt type these lines (substituting your real site url & pressing <enter> after each line):

USE wordpress;
UPDATE wp_options SET option_value='http://www.yoursite.com' WHERE option_name='home';
UPDATE wp_options SET option_value='http://www.yoursite.com' WHERE option_name='siteurl';
quit;

I'm not sure why Alons code didn't work (perhaps it needs to be run as a script instead of just typed at the commandline?) but I tested what I posted here and it works.

Alon Swartz's picture

Oops! bad html'ization

Sorry about that, the copy/paste I did to the comment area lost the formatting when converting to html, thats why it didn't work - there is a missing << EOF

SITE='http://www.yoursite.com'
mysql --defaults-extra-file=/etc/mysql/debian.cnf <<EOF
USE wordpress;
UPDATE wp_options SET option_value='$SITE' WHERE option_name='home';
UPDATE wp_options SET option_value='$SITE' WHERE option_name='siteurl';
EOF

Thanks Jeremy.  Your code got

Thanks Jeremy.  Your code got me through it. 


Thanks!

I used Webmin to edit the MYSQL table. Between both settings changes I was able to get my new site up (http://www.thominfotech.com). Many thanks!

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)