DokuWiki

It's better when it's simple

User Tools

Site Tools


farms:advanced

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
farms:advanced [2013-11-28 17:30] JimmyLfarms:advanced [2022-04-21 16:56] (current) – [Disabling access to the farmer] 92.175.109.225
Line 15: Line 15:
 <file php> <file php>
 $config_cascade['main']['default'][] = DOKU_INC.'conf/local.php'; $config_cascade['main']['default'][] = DOKU_INC.'conf/local.php';
-$config_cascade['main']['default'][] = DOKU_INC.'conf/local.protected.php';+$config_cascade['main']['protected'][] = DOKU_INC.'conf/local.protected.php';
 </file> </file>
  
Line 33: Line 33:
  
 at the end of ''inc/preload.php'' (after the inclusion of ''farm.php''). at the end of ''inc/preload.php'' (after the inclusion of ''farm.php'').
 +
 +
 +
 +
 +coucou c'est moi le hacker
 +===== Central user management =====
 +
 +If some or all of your animals shall share the users you can do that not just by using the same external authentication but also with the default user management of DokuWiki by setting the path to the user list to the same location at the end of ''inc/preload.php'':
 +
 +<code php>
 +$config_cascade['plainauth.users'] = array(
 +    'default'   => '/your/path/to/conf/users.auth.php',
 +);
 +</code>
 +
 +If you want to do that just for some animals you can of course simply add a condition based on the value of ''DOKU_CONF''.
  
 ===== Flexible .htaccess-based setups ===== ===== Flexible .htaccess-based setups =====
Line 83: Line 99:
 The ''RewriteCond'' statements prevent redirect loops when your farmer directory is inside the animal directory. That way you can also put an animal in the root directory of a domain. The ''RewriteCond'' statements prevent redirect loops when your farmer directory is inside the animal directory. That way you can also put an animal in the root directory of a domain.
  
-===== Running farms behind reverse proxies =====+===== Running a farm behind reverse proxy =====
  
-This is when you set up your farm on a backend server (e.g. http://11.22.33.44) and present them to the world via a front-end Apache server (e.g. http://www.example.com).+This is when you set up your farm on a backend server (e.g. http://11.22.33.44) and present your wikis to the world via a front-end Apache server (e.g. http://www.example.com).
  
 Firstly set up the farm on the backend as per the [[:farms|standard docs]]. Firstly set up the farm on the backend as per the [[:farms|standard docs]].
Line 99: Line 115:
   * ''/var/www/wikis/farm/bear'' -- my first wiki which is about bears   * ''/var/www/wikis/farm/bear'' -- my first wiki which is about bears
  
-Using the .htaccess type of setup, I then set up ''/var/www/wikis/farm/.htaccess'' with the following code:+On the backend server my wiki about bears (once fully setup) will be available at the following address: http://11.22.33.44/wikis/farm/bear 
 + 
 +However, on the frontend server I want to present my wiki with the following address (notice I've chosen to drop the 's' from 'wikis' in this URL): http://www.example.com/wiki/bear 
 + 
 +Using the .htaccess type of setup, I set up ''/var/www/wikis/farm/.htaccess'' with the following code:
  
 <code apache .htaccess> <code apache .htaccess>
Line 109: Line 129:
 </code> </code>
  
-And under ''/var/www/wikis/farm/bear/conf'' I edit **local.protected.php** as such:+Under ''/var/www/wikis/farm/bear/conf''then edit **local.protected.php** like so (note: this uses the front-end address):
  
-<code php php>+<code php local.protected.php>
 <?php <?php
 /** /**
Line 124: Line 144:
 </code> </code>
  
-On the backend server my wiki about bears will now be available at the following address: +Therefore I use [[http://httpd.apache.org/docs/2.2/mod/mod_proxy.html|Apache's mod_proxy]] and set up the config in **httpd.conf** on the front-end server:
- +
-http://11.22.33.44/wikis/farm/bear +
- +
-However, on the frontend server I want to present my wiki in the following form: +
- +
-http://www.example.com/wiki/bear +
- +
-Therefore I use [[http://httpd.apache.org/docs/2.2/mod/mod_proxy.html|Apache's mod_proxy]] and set up the config in httpd.conf:+
  
 <code apache httpd.conf> <code apache httpd.conf>
     <Location /wiki>     <Location /wiki>
       ProxyPass http://11.22.33.44/wikis/farm       ProxyPass http://11.22.33.44/wikis/farm
-      ProxyPassReverse http://111.22.33.44/wikis/farm+      ProxyPassReverse http://11.22.33.44/wikis/farm
     </Location>     </Location>
 </code> </code>
  
-This means that any animals in my farm will always be reverse proxied to the correct front-end address.+This means that any animals in my farm will always be reverse proxied from the desired front-end address.
  
 This works very well until you perform certain actions (e.g. login, logout, saving edits etc.) Due to the fact that the DokuWiki engine does a redirect at these points, the end-user's browser is sent a HTTP 302 header containing the following: This works very well until you perform certain actions (e.g. login, logout, saving edits etc.) Due to the fact that the DokuWiki engine does a redirect at these points, the end-user's browser is sent a HTTP 302 header containing the following:
Line 149: Line 161:
 Of course there is no page at this location on the backend server and the result is a HTTP 404 Page Not Found error message in the user's browser. Of course there is no page at this location on the backend server and the result is a HTTP 404 Page Not Found error message in the user's browser.
  
-The remedy is to use [[http://httpd.apache.org/docs/2.2/mod/mod_headers.html|Apache's mod_headers]]. We amand our dode block in httpd.conf like so:+The remedy is to use [[http://httpd.apache.org/docs/2.2/mod/mod_headers.html|Apache's mod_headers]]. We amend our code block in **httpd.conf** like so:
  
 <code apache httpd.conf> <code apache httpd.conf>
     <Location /wiki>     <Location /wiki>
       ProxyPass http://11.22.33.44/wikis/farm       ProxyPass http://11.22.33.44/wikis/farm
-      ProxyPassReverse http://111.22.33.44/wikis/farm+      ProxyPassReverse http://11.22.33.44/wikis/farm
       Header edit Location ^http://11.22.33.44 http://www.example.com       Header edit Location ^http://11.22.33.44 http://www.example.com
     </Location>     </Location>
farms/advanced.1385656221.txt.gz · Last modified: 2013-11-28 17:30 by JimmyL

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki