Jump to content

Multi site without symlink


SwimToWin
 Share

Recommended Posts

How can I install ProcessWire above the root without having to use symbolic links?

Advantages from this setup:

  • Updating ProcessWire is done by updating just one folder.
  • Works on localhost and online without having to setup symbolic links.
  • Reuse of the ProcessWire code (no need to have multiple installations when one will do) and of course minimal footprint on my hosted web-server.

I experimented with this setup in index.php and I think at least four links are needed to make the "one installation folder for multiple sites"-setup work:

  • System server-path to the wireDir that defaults to /wire ($rootPath).
  • System web-path to wire for stylesheets and more in /wire/templates-admin files (undefined, suggested variable name: $rootPathWeb).
  • App server-path to Site-folder for the current app (suggested variable name: $appPath).
  • App web-path to the Site-folder for the current app (suggested variable name: $appPathWeb).


Here is how the variables might look in index.php:

  • $rootPath = "/server-folder/to/processwire_latest";
  • $rootPathWeb = "/processwire_latest";
  • $appPath = "/server-folder/www.fancysite.com";
  • $appPathWeb = "/www.fancysite.com";


Or better (CodeIgniter-style):

  • $path['production']['rootPath'] = "/webhotel-server-folder/to/processwire_latest";
  • $path['production']['rootPathWeb'] = "http://www.processwire-templates-admin.com"; #Not sure about this path (PW can just require that /templates-admin is in /site).
  • $path['production']['appPath'] = "/webhotel-server-folder/www.fancysite.com";
  • $path['production']['appPathWeb'] = "/";
  • $path['development']['rootPath'] = "/server-folder/to/processwire_latest";
  • $path['development']['rootPathWeb'] = "/processwire_latest";
  • $path['development']['appPath'] = "/server-folder/www.fancysite.com";
  • $path['development']['appPathWeb'] = "/www.fancysite.com";

Related posts:

Link to comment
Share on other sites

> Option #1: multiple sites with multiple databases

This only works for domain and it's sub-domains, right? So each of these domains and sub-domains can use the same /wire folder: www.example.com, tic.example.com, tac.example.com, toe.example.com. Or maybe I didn't understand it right?

Perhaps this is how Option #1 works?

www.example.com/admin
admin.tic.com/admin => points at www.example.com/admin
admin.tac.com/admin => points at www.example.com/admin
admin.toe.com/admin => points at www.example.com/admin
 

Thanks.

Link to comment
Share on other sites

It works like this:

'example.com' => 'site-example',
'www.example.com' => 'site-example',
'subdomain.of.example.com' => 'site-subexample'
'whatever.com' => 'site-whatever',
'example.pt' => 'site-ptexample',
'anotherexample.com' => 'site-another',
  • Like 1
Link to comment
Share on other sites

Is it possible for this to work with subfolders instead of sub-domains?

Example

mainsite.com

mainsite.com/site1

mainsite.com/site2

I have followed the steps here, but I am not having any luck getting the subfolders to work.

Link to comment
Share on other sites

Is it possible for this to work with subfolders instead of sub-domains?

You don't really need any kind of multi-site support if you are just talking about subdirectories. If you want them to use the same database, then just make them all run from the same PW install. If you want them to run from separate databases, then just install PW in the root and the subdirectory… should you want to share the same core, then make /subdir/wire/ a symlink to /wire/. Though when I'm running more than one PW install on the same account, I usually just keep their cores separate so that I can upgrade and test them separately. But it's perfectly fine to run multiple PW installs on the same domain. 

  • Like 1
Link to comment
Share on other sites

Hi Ryan,

Thanks for the reply.  I did think of a new pw install per sub-directory, but thought it would be less maintenance if I had one core. Ideally the project I am working on is one site, but I need a separate database per directory.  I looked into the sub-domain and completely overlooked the initial sentence on your instructions of pointing the sub-domain to the main domain. I have not tried it yet, but everyone else has seemed to accomplished it, although I am a little confused on how the url would work if the sub-domain is pointing to the main domain.

In regards to the symlink, I am not familiar with them at all, so I will need to look into how to work one up. Thanks for the info and hopefully I will figure out the symlink part. If not I might just go the easy route and do a new pw install per directory. Although I will have a significant amount of directories and could see space being an issue.

Link to comment
Share on other sites

In regards to the symlink, I am not familiar with them at all, so I will need to look into how to work one up. Thanks for the info and hopefully I will figure out the symlink part. If not I might just go the easy route and do a new pw install per directory. Although I will have a significant amount of directories and could see space being an issue.

Symbolic links are roughly the equivalent of shortcuts in Windows environment, if that's what you're more familiar with. They're just pointers to some other location. Having /wire/ as a symlink pointing to another location means that anything you change in that other place is instantly in use anywhere it's linked.

This is most likely the easiest way to use one PW core (which, I believe, is what you're trying to achieve here) with multiple directories.. or sharing it with multiple sites in general :)

Creating a symlink is as simple as doing this in your site1 / site2 directory:

ln -s /var/www/your/primary/pw/installations/wire wire

You'll still need to keep some files (in addition to a /site/ directory) in each subdirectory; most importantly .htaccess and index.php.. though I guess you could make those links to somewhere else too if it really matters.

  • Like 4
Link to comment
Share on other sites

  • 3 months later...

Creating a symlink is as simple as doing this in your site1 / site2 directory:

ln -s /var/www/your/primary/pw/installations/wire wire

could you pls try to explain how to do this for us stupid designers ;-) I don't have shell access on my webserver anyway...

Link to comment
Share on other sites

After both Ryan and Teppo pointed me in the right direction, I tried using ftp to create a symlink with no luck. However, FireFTP claims you can but I have not tried it. On a side note, I figured out that my host by default disables shell access and mentions very little about it. After contacting them, they enabled it for me with no problems. Also, this is not related to PW, but helped make the picture clearer. Just my 2 cent.

  • Like 1
Link to comment
Share on other sites

  • 3 months later...
  • 6 months later...

I have two installations of PW on the same domain. 1. being in the root and another being in a sub directory. I took Ryan's advice and created a symlink for the wire directory, but I was curious if I needed the following files in the sub directory as well.

.gitignore

.htaccess

I am not sure if the ones in the root would suffice?

**Edit

Looks likes Teppo answered my question above and I over looked it. 

Edited by RJay
Link to comment
Share on other sites

  • 9 months later...

Hi,

i am trying to setup multi site on web server with few domains. on local host i was using symlink but now i am unable to create a symlink on web server, i have talked to web hosting company and they told me that they did't allow symlink due to security reasons. now i am thinking of some other way to have one wire folder and run 3 websites on 3 different domains.

i found this link

https://processwire.com/talk/topic/3534-one-processwire-installation-folder-for-multiple-sites-without-symbolic-links/

where it suggest to change variable in index.php file but i could not figure out how to do that.

all my three domains are in one server and this is physical path of server with wire folder

/home/domain1/public_html/wire

for example my new domains which want to access wire folder is "domain2"

so now what will be values for 

  • $rootPath = ?
  • $rootPathWeb = ?
  • $appPath = ?
  • $appPathWeb = ?

 

 

Thanks

Edited by LostKobrakai
Moved this to the right topic
Link to comment
Share on other sites

I have one central 'wire' folder, with multiple sites symlinking and it works great.

I do the same with the site/modules folder, so all sites have access to the same modules.

Something I've found: I have to SSH as root to create my symlinks, but then I need to chown them from root to the correct user or they won't work.

Link to comment
Share on other sites

Hello,

in my hosting server they are using suphp php handler, is this possible to use symlink in this php handler ?

if its possible , how ?

do that folder need some special permission for user who is accessing that folder or what ?

or is there any other way of using one wire installation for multiple domains without using symlink.

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...