The Joyent Community

A place where the Joyent community can gather, help each other out, and stay informed.

You are not logged in.

#1 2008-07-10 15:42:23

scoby
New member
From: Dublin, Ireland
Registered: 2008-05-18
Posts: 7
Website  Expertise

one copy of wordpress serving multiple domains

I wanted to use a single install of wordpress to serve a few domains on my 1/4 accelerator
I'm following this tutorial
http://www.ryanmcdonnell.com/multiple-b … e-changes/

which puts the wordpress code in a folder ( I'm using /home/.wordpress/ )

and then symlinks from the normal web directory

/home/declancostello.com/web/public/

I've followed the instructions but I'm just getting a blank page when I load
www.declancostello.com

the phpinfo is avail at
www.declancostello.com/phpinfo.php

I can see that the php_value I'm setting in my .htaccess
is being included properly

Has anyone here got a single wp install running multiple blogs?

One thing I'm not really familiar with is permissions, can anyone suggest what my perms should be for a setup like this?


When you make the finding yourself, even if you're the last person on earth to see the light, you'll never forget it. -- Carl Sagan

Offline

 

#2 2008-07-10 18:29:32

billturner
Member
From: Pittsburgh, PA
Registered: 2005-05-27
Posts: 62
Website  Expertise

Re: one copy of wordpress serving multiple domains

As far as I know, you can't run multiple blogs with a single installation of Wordpress. You'll need something like Wordpress MU: http://mu.wordpress.org/

Offline

 

#3 2008-07-10 19:04:00

kchrist
Member
From: Portland, Oregon
Registered: 2005-12-16
Posts: 540
Website  Expertise

Re: one copy of wordpress serving multiple domains

You can run multiple sites on a single WP install without using that god-awful WPMU, but it takes a bit of work. That said, the method here looks like a major pain in the ass. Make symlinks for every single one of those files? That's insane.

Try installing WP somewhere reasonable (I'd recommend not using a .hidden directory, just for convenience) and then, in each web site directory, create a symlink to the WP directory, instead of each file. Something like this:

Code:

 /var/www/wordpress

/var/www/example.org /var/www/example.org/wp -> ../wordpress


Then copy the main WP index.php into each site's directory and change the path from "./wp-blog-header.php" to "./wp/wp-blog-header.php".

Finally, in wp-config.php create a hash with database prefixes and web site hostnames and change the table_prefix line to use the hostname as a key to find the appropriate table prefix:

Code:

 $prefix = (

"www.example.org" => "wp1_", "blog.example.net" => "wp2_", ); $site = $_SERVER['HTTP_HOST']; $table_prefix = $prefix[$site];


You'll need to go through the WP install once for each site in order to set up the database tables, but you'll be ready to go after that. All your themes will go in a single location and you'll have a single directory for your plugins, which can then be enabled on a site-by-site basis, as needed.

This is all off the cuff; I haven't implemented this yet but I've been meaning to. I'm actually using a slightly different method for multi-WP sites but this one is a bit better.


Kenn Wilson
:: Corvid Works : Linux system administration and web consulting
:: Hextractor : Create an HTML color palette from your CSS
:: Cocktailia : Classic cocktails and bar reviews

Offline

 

#4 2008-07-10 19:31:57

Christopher
Support Engineer
From: Toronto, Canada
Registered: 2004-06-02
Posts: 822
Website  Expertise

Re: one copy of wordpress serving multiple domains

@kchrist , that's a nice solution. Love to test it out sometime. Never tried WPMU. What was your experience like?


Horrell.ca | chorrell on Twitter

Offline

 

#5 2008-07-10 21:07:16

scoby
New member
From: Dublin, Ireland
Registered: 2008-05-18
Posts: 7
Website  Expertise

Re: one copy of wordpress serving multiple domains

Thanks kchrist, I'll give that a try and report back.


When you make the finding yourself, even if you're the last person on earth to see the light, you'll never forget it. -- Carl Sagan

Offline

 

#6 2008-07-11 01:35:25

iolaire
Member
From: Arlington, VA USA
Registered: 2005-03-02
Posts: 813
Website  Expertise

Re: one copy of wordpress serving multiple domains

kchrist wrote:

You can run multiple sites on a single WP install without using that god-awful WPMU


kchrist - can you share any of your experience with this? Would say converting 19 low traffic WPMU sites cut down on the Apache Ram usage significantly? I'm learning more an more that WPMU is quite a memory hog.


My refurbished Mac site -> While Supplies Last. The next site is Decreasing Prices with daily updates and minor tweaks now and then...

Offline

 

#7 2008-07-11 15:25:59

kchrist
Member
From: Portland, Oregon
Registered: 2005-12-16
Posts: 540
Website  Expertise

Re: one copy of wordpress serving multiple domains

I haven't used WPMU on a public site, so I can't comment on the resource usage, but my multi-WP method above will be the same as using a regular WP install for each site. I don't know if this is better or worse than WPMU.

My problem with WPMU is that it's a major pain to get working in a reasonable way, the community is not very helpful, and the developers do asinine things like enforce their "no-www" preference in code (seriously, it won't let you install for www.example.org instead of just example.org). There's also no reasonable way to make it work for multiple distinct domains instead of just subdomains, which makes it fine for community blogs and the like but not really useful for consolidating multiple sites (it's possible to do multiple sites, just not very easy).


Kenn Wilson
:: Corvid Works : Linux system administration and web consulting
:: Hextractor : Create an HTML color palette from your CSS
:: Cocktailia : Classic cocktails and bar reviews

Offline

 

#8 2008-07-11 23:26:19

jacques
The Local Coffee Aficionado
From: Cape Town, South Africa
Registered: 2005-06-28
Posts: 1692
Website  Expertise

Re: one copy of wordpress serving multiple domains

WPMU on a public site requires some dedicated resources. Memcache to stop pounding the database when spammers come around and cause chaos. APC to at least cache the PHP opcodes that are compiled and to speed things up. The updates for WPMU can cause breakages often so one has to be careful to use point releases and upgrade only weeks after a point release in order to have time to back port pactches over.

Offline

 

#9 2008-07-12 13:43:06

iolaire
Member
From: Arlington, VA USA
Registered: 2005-03-02
Posts: 813
Website  Expertise

Re: one copy of wordpress serving multiple domains

Thanks for the info guys.


My refurbished Mac site -> While Supplies Last. The next site is Decreasing Prices with daily updates and minor tweaks now and then...

Offline

 

#10 2008-07-18 22:04:20

scoby
New member
From: Dublin, Ireland
Registered: 2008-05-18
Posts: 7
Website  Expertise

Re: one copy of wordpress serving multiple domains

Alright, I've had some success with the method here but I'm still not all the way there.

I copied my wordpress files to /home/wordpress

and added this to wp-config.php

Code:

$prefix = array(

"www.declancostello.com" => "wp_", "declancostello.com" => "wp_", "www.everydayhypnosis.com" => "evhyp_", "everydayhypnosis.com" => "evhyp_" );

$site = $_SERVER['HTTP_HOST'];
$table_prefix = $prefix[$site];


I tried to symlink
/home/declancostello.com/web/public/wp -> /home/wordpress

But I found that it left a lot of files without a link
wp-login.php
wp-admin/install.php

SO after some testing I ended up linking the entire folder and the 3 directories to the central location

Code:

#!/bin/sh

ln -s /home/wordpress/index.php index.php
ln -s /home/wordpress/wp-admin /wp-admin
ln -s /home/wordpress/wp-atom.php wp-atom.php
ln -s /home/wordpress/wp-blog-header.php wp-blog-header.php
ln -s /home/wordpress/wp-comments-post.php wp-comments-post.php
ln -s /home/wordpress/wp-commentsrss2.php wp-commentsrss2.php
ln -s /home/wordpress/wp-cron.php wp-cron.php
ln -s /home/wordpress/wp-feed.php wp-feed.php
ln -s /home/wordpress/wp-includes wp-includes
ln -s /home/wordpress/wp-content wp-content
ln -s /home/wordpress/wp-links-opml.php wp-links-opml.php
ln -s /home/wordpress/wp-login.php wp-login.php
ln -s /home/wordpress/wp-mail.php wp-mail.php
ln -s /home/wordpress/wp-pass.php wp-pass.php
ln -s /home/wordpress/wp-rdf.php wp-rdf.php
ln -s /home/wordpress/wp-register.php wp-register.php
ln -s /home/wordpress/wp-rss.php wp-rss.php
ln -s /home/wordpress/wp-rss2.php wp-rss2.php
ln -s /home/wordpress/wp-settings.php wp-settings.php
ln -s /home/wordpress/wp-trackback.php wp-trackback.php
ln -s /home/wordpress/xmlrpc.php xmlrpc.php


That worked for me and then to create the second wp blog I didn't have to upload any files, merely add some more symlinks

Code:

cp -r -P /home/declancostello/web/public/* /home/everydayhypnosis/web/public


-P copies the symlinks, it doesn't copy what the symlinks point to.

after that single command I went to the second domain and saw the wordpress install page :)

I have a single central place for themes and plugins which can be selected and activated for each site individually.

My final ( hopefully ) problem is with .htaccess

I can't get permalinks working.
Wordpress reports no errors but it doesn't change the .htaccess I put in /home/declancostello/web/public/

It links a post as a permalink style

/2008/08/post-title

But gives a 404 when you click through.

I got this from webmin

Code:

SuexecUserGroup "#1002" "#1003"
ServerName declancostello.com
ServerAlias www.declancostello.com *.declancostello.com
DocumentRoot /home/declancostello.com/web/public
UserDir /home/declancostello.com/homes/*/web/public
CustomLog /home/declancostello.com/logs/access_log combined
ScriptAlias /cgi-bin/ /home/declancostello.com/cgi-bin/
ScriptAlias /fcgi-bin/ /home/declancostello.com/fcgi-bin/
<Directory /home/declancostello.com/web/public>
Options -Indexes IncludesNOEXEC FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>


Thanks for getting me this far.


When you make the finding yourself, even if you're the last person on earth to see the light, you'll never forget it. -- Carl Sagan

Offline

 

#11 2008-07-19 16:50:55

scoby
New member
From: Dublin, Ireland
Registered: 2008-05-18
Posts: 7
Website  Expertise

Re: one copy of wordpress serving multiple domains

I just checked my .htaccess file and it was empty!

I found the following on another site

http://perishablepress.com/press/2006/06/14/the-htaccess-rules-for-all-wordpress-permalinks/

Code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

  1. END WordPress


with this copied into my .htaccess

My centrally installed wordpress has friendly urls :D

Thanks again for the suggestions and advice in this thread

thumbs up


When you make the finding yourself, even if you're the last person on earth to see the light, you'll never forget it. -- Carl Sagan

Offline

 

#12 2008-07-19 16:56:15

kchrist
Member
From: Portland, Oregon
Registered: 2005-12-16
Posts: 540
Website  Expertise

Re: one copy of wordpress serving multiple domains

scoby wrote:

SO after some testing I ended up linking the entire folder and the 3 directories to the central location


I probably should have clarified a bit more. If you install WP into a subdirectory instead of the root of the site, you only need one symlink to this directory rather than for each individual file.

So if your site is example.org, WP would be installed at example.org/wp (or whatever you name the directory). You can still display the WP content at the root of the domain by copying the index.php file and adjusting the path, as shown in my earlier post.


Kenn Wilson
:: Corvid Works : Linux system administration and web consulting
:: Hextractor : Create an HTML color palette from your CSS
:: Cocktailia : Classic cocktails and bar reviews

Offline

 

#13 2008-08-18 18:29:54

asiabird01
New member
Registered: 2008-08-18
Posts: 1
Expertise

Re: one copy of wordpress serving multiple domains

@scoby - I've never done symlinks before, but I do have SSH from my host provider. I have 4 sites that I want to use from a single install of WP. I want to be able to upload theme's and plugins once and then be able to activate them separately across the different domains. Have you ever considered making a tutorial for dummies (like me) using your method above? I need super detailed instructions!!

I have www.domain-1.com
www.domain2.com
www.domain3.net

what is /var/www/? Is does the 'var' just stand for variable where 'var' means the path to your www directory?

Also, I use my local computer to edit/change stuff on my WP theme, and then I 'publish' it to my live site on bluehost. Will this method (using the symlinks) still work if I do that? Do I need to create symlinks on my local computer as well for the 'edit/changing'?

Any help you can give is greatly appreciated!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson