TurnKey Linux Virtual Appliance Library

Solved! Moving WordPress to root folder to make it multi-site compatible

I need to use WordPress in multi-site mode and, from reading the WP documentation, I see that it won't work in a sub-folder so I've moved it from the /var/www/wordpress folder to /var/www.

Since this wasn't straightforward, I thought I'd outline the steps (which I discovered  through a lot of searching and trial and error):

1) Delete the index.html file in /var/www.

2) Move the files from the /wordpress folder into /var/www.

3) Edit the Apache virtual hosts for ports 80 and 443  to point to /var/www.

4) Edit the directives in the WordPress config file to point to /var/www.

5) In the wp-options table in the wordpress database, change the siteurl and home fields to your site's IP address. Not sure if this is strictly necessary (or even advisable) but I did it and everything seems to be OK.

6) Log onto the web shell and enter the following command: chown -R www-data: /var/www

This last step changes the ownership of the root directory so that WordPress can write to it.

I hope that helps anyone struggling with this.

PS When you convert to multi-site, you will be asked to create a blogs.dir folder and, possibly, an .htaccess file. Make sure you set the ownership of thess to www-data (just like all the other files and folders in /var/www) so that wordpress can access them.

Jeremy's picture

Good on you for posting back :)

Thanks for that, hopefully it will help someone else (I'm sure it will). I read your initial post but had nothing useful for you. Only thing I'd suggest is that IMO step 6 would ideally be:

chown -R www-data:www-data /var/www

As it then will be owned by www-data user and www-data group. Obviously your way still works, but I think it is better to explicitly set the group as well.

For clarity (others reading this and finding it useful): You can just run that same command again after creating blogs.dir folder and .htaccess (or any other) file(s). The -R switch makes the chown command recursive ie the folder and all of it's contents.

Great post. Need help though

Hi Andrew, thanks for the info.

I am new at this and am hoping you can please expand a little on the 4th step.

[ 4) Edit the directives in the WordPress config file to point to /var/www. ]

Opened the file up but haven't a clue what to enter.

Any assistance gratefully accepted.

Thanks

 

----------------------

Update

----------------------

Just to let you know.

I seemed to have got it working.

But for step 4 i needed to  define '/' and not '/var/www' in the wp-configfile, for it to work.

Hope thats ok


Glad it helped

It's nice to know my experience is helping others, so thanks for letting me know Owen.

I've actually decided to build my own server using Nginx, and it's loads faster than Apache.

Cheers,

Andrew

Jeremy's picture

Yeah there has been talk of offerring a lighter weight webserver

FYI from what the devs have said previously Apache was chosen as the default for TKL appliances because of the (relavative) ease of config as well as the huge amount of documentation available (and generally easier to get help with). Also the fact that there is no Webmin module for NginX makes the bar a little higher too.

getting the sub-domain install option to show up

To get the sub-domain install option to show, the siteurl must not have a "/" (mydomain.com/anything) or be "localhost" or be an IP address.

I spent too many hours trying to get the subdomain option to show and it was because I was testing things out using a copy of my site running with just a bare ip address (192.168.x.x).   So I just entered a hosts file entry (e.g., 192.168.1.2 mydomain) and browsed to mydomain and then "sub-domain install" appeared on the network menu.

already documented

And this is clearly documented in Create_A_Network, including the solution I mentioned.  Sorry.

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)