You are here

INSTALL.txt in Domain Access 6.2

INSTALL file for Domain Access.

File

INSTALL.txt
View source
  1. /**
  2. * @file
  3. * INSTALL file for Domain Access.
  4. */
  5. Domain Access
  6. A domain-based access control system.
  7. CONTENTS
  8. --------
  9. 1. Introduction
  10. 2. Installation
  11. 2.1 Before Installing
  12. 2.2 Server Configuration
  13. 2.3 Setting DOMAIN_INSTALL_RULE
  14. 2.4 Setting DOMAIN_SITE_GRANT
  15. 2.5 Setting DOMAIN_ASSIGN_USERS
  16. 3. Installing the Module
  17. 3.1 After Installation
  18. 4. Configuring settings.php
  19. 4.1 $base_url
  20. 4.2 $db_prefix
  21. 4.3 $cookie_domain
  22. 4.4 Add settings.inc
  23. 4.4.1 Installation
  24. 4.4.2 Option 1
  25. 4.4.3 Option 2
  26. 4.4.4 Testing Your Configuration
  27. 4.4.5 Additional Resources
  28. 4.5 custom_url_rewrite_outbound()
  29. 5. Additional Module Installation
  30. 5.1 Domain Strict
  31. 6. Uninstalling
  32. ----
  33. 1. Introduction
  34. The Domain Access module is a Node Access module. It is designed to
  35. restrict access to content.
  36. WARNINGS:
  37. - Failure to install or uninstall this module according to instructions
  38. may cause errors in your site.
  39. - Node Access rules never apply to user 1 (the site admin) or to users
  40. with the 'administer nodes' permission. As such, these users will always
  41. be able to see all content on your site(s). To verify that Domain Access
  42. is working correctly, you will need to turn on its debug mode or view the
  43. site as a user without this permission. You may also enable the 'Enforce
  44. rules on adminstrators' setting, which will apply Domain Access
  45. restrcitions to all users. (See section 4.3.3 of README.txt for more
  46. details on this feature.)
  47. ----
  48. 2. Installation
  49. This module requires some advanced understanding of Drupal and of
  50. how DNS servers behave. If you simply untar the download and
  51. activate the module, it may not work correctly.
  52. Domain Access works by reading the inbound HTTP_HOST request
  53. and serving content appropriate to the requested domain. For this to
  54. work properly, all domains for your site must be routed to the same
  55. Drupal installation on your webserver.
  56. Domain Access was not designed to run on shared hosts, and you may need
  57. assistance from your provider to make it work correctly.
  58. For more background on DNS and virtual host configuration, please try the
  59. following documentation:
  60. For a general overview:
  61. - http://en.wikipedia.org/wiki/Virtual_hosting
  62. In-depth documentation with many examples for specific situations:
  63. - http://httpd.apache.org/docs/2.0/vhosts/
  64. - http://httpd.apache.org/docs/2.0/vhosts/examples.html
  65. When you enable the module, it will create a {domain} table in your Drupal
  66. database.
  67. On installation, all existing nodes on your site will be assigned to the default
  68. (primary) domain for your web site as well as to all subdomains.
  69. In order to change this behavior, see sections 2.3 and 2.4 below.
  70. ----
  71. 2.1 Before Installing
  72. You will need to do the following before you install the module.
  73. - Read this document
  74. - Configure your web server DNS records appropriately
  75. - Read the supplied README.txt
  76. - Install and configure Drupal normally.
  77. WARNING: The Domain Access module series instructs you to add a
  78. file include to your settings.php file. Do not add this command until
  79. after you have installed Drupal.
  80. ----
  81. 2.2 Server Configuration
  82. For the module to work correctly, the DNS record of your server must accept
  83. multiple DNS entries [most servers do]. Your new virtual host(s) must then
  84. be correctly configured for your server. In general, this involves small
  85. additions to the hosts file and the httpd.conf file.
  86. In order for the Apache server to find your virtual host(s), it absolutely
  87. needs two pieces of information: the ServerName (hostname & port the server
  88. uses to identify itself) and an IP address.
  89. The two basic methods for doing this are to either:
  90. - Set up WildCard DNS, so that *.example.com resolves to your Drupal site.
  91. (The asterisk indicates any and all names carrying the < example.com >
  92. suffix)
  93. - Set up each VirtualHost specifically, so that one.example.com,
  94. two.example.com, (and so on) all resolve to your Drupal site.
  95. For example, on a local testing machine, VirtualHosts in my hosts file could be
  96. configured in the following way:
  97. - ken.test => 127.0.0.1
  98. - one.ken.test => 127.0.0.1
  99. - two.ken.test => 127.0.0.1
  100. - foo.test => 127.0.0.1
  101. With their port and document root defined (WildCard set up) in the httpd.conf
  102. file:
  103. DocumentRoot /path/to/drupal/install
  104. ServerName ken.test
  105. ServerAlias *.ken.test foo.test
  106. In this case any subdomain (*.ken.test) and another domain foo.test resolve to
  107. the same location. When configuring DNS for Domain Access, the document root is
  108. the same for all the VirtualHosts. The documentRoot directive sets the directory
  109. from which httpd will serve files. For DA, there is one Drupal installation and
  110. it is this installation built on a single database that is serving the files.
  111. This becomes even clearer when the VirtualHosts are set up specifically,
  112. each with its own VirtualHost block in the httpd.conf file, for example:
  113. DocumentRoot /path/to/drupal/install
  114. ServerName ken.test
  115. DocumentRoot /path/to/drupal/install
  116. ServerName two.ken.test
  117. DocumentRoot /path/to/drupal/install
  118. ServerName foo.test
  119. This example gives a general idea of what is involved, but it is beyond the
  120. scope of this document to explain how to configure your specific DNS server
  121. situation, which may involve considerable research, trial & error or a call for
  122. help. Shared server situations can be particularly complicated and you should
  123. contact their administration for help with configuration if their online help
  124. files do not make things clear enough.
  125. After you have enabled multiple DNS entries to resolve to your single,
  126. default Drupal installation, you may activate the module and configure its
  127. settings at Admin > Build > Domains.
  128. ----
  129. 2.3 Setting DOMAIN_INSTALL_RULE
  130. This is an advanced instruction, and may be ignored.
  131. At the top of the domain.module file, you will find this line:
  132. define('DOMAIN_INSTALL_RULE', TRUE);
  133. This setting controls the default behavior of the module when installing over
  134. an existing installation. If set to TRUE, the Domain Access module will assign
  135. all existing nodes to be viewable by your primary domain.
  136. If you set this value to FALSE, existing content will not be visible on your
  137. primary domain unless DOMAIN_SITE_GRANT is set to TRUE.
  138. For more details, see section 5 of README.txt.
  139. ----
  140. 2.4 Setting DOMAIN_SITE_GRANT
  141. At the top of the domain.module file, you will find this line:
  142. define('DOMAIN_SITE_GRANT', TRUE);
  143. This setting controls the default behavior for viewing affiliate content.
  144. By design, the Domain Access module allows site administrators to assign
  145. content to 'all affiliates.' If this value is set to TRUE, then content
  146. assigned to all affiliates can be seen by all users on all current domains.
  147. On install, setting this value to TRUE will assign all current content to
  148. be viewable on all domains.
  149. Normally, you will not need to edit this value.
  150. ----
  151. 2.5 Setting DOMAIN_ASSIGN_USERS
  152. At the top of the domain.module file, you will find this line:
  153. define('DOMAIN_ASSIGN_USERS', TRUE);
  154. After you install the Domain Access module, all new users who
  155. register will automatically be assign to the domain from which
  156. their account was created. This value is used to determine
  157. advanced editing access and can be used by modules such as
  158. Domain Strict.
  159. On install, setting this value to TRUE will assign all current users
  160. to be members of the default domain. Set the value to FALSE
  161. and the module will not assign users to any domains.
  162. Normally, you will not need to edit this value.
  163. After installation and configuration, users with the appropriate
  164. permissions may batch assign users to domains from
  165. Administer > User Management > Users.
  166. ----
  167. 3. Installing the Module
  168. After you have prepared your server and made any edits to the
  169. default module behavior, you may install Domain Access like any
  170. other Drupal module.
  171. ----
  172. 3.1 After Installation
  173. Note that as of 6.x.2.0, the primary domain is created for you on
  174. installation.
  175. The primary domain will use the SERVER_NAME value of the request made
  176. when installing the module. This value may be edited by going to
  177. Admin > Build > Domains and editing the Primary Domain value.
  178. After you install the module, you should visit Admin > Users > Permissions
  179. and set the module permissions; normally you will give your site
  180. administrators the following permissions:
  181. -- 'administer domains'
  182. -- 'set domain access'
  183. After saving permissions, go to Admin > Build > Domains and configure
  184. your site's Primary Domain.
  185. For more information, see README.txt.
  186. ----
  187. 4. Configuring settings.php
  188. Remember, the Domain Access module lets you run multiple sites
  189. from a single installation. You only need one settings.php file.
  190. As a result, some options in your settings.php file need to be
  191. considered carefully.
  192. ----
  193. 4.1 $base_url
  194. The $base_url setting is normally not set. With Domain Access, you
  195. cannot set this value manually.
  196. Since multiple domains are involved, Drupal needs to be allowed to
  197. set this value. (For the technical, this happens in the conf_init()
  198. function).
  199. If you need to install Drupal in a subdirectory and wish to hide that
  200. subdirectory from site visitors, you may set $base_url dynamically.
  201. See the instructions at http://drupal.org/node/633726.
  202. ----
  203. 4.2 $db_prefix
  204. The $db_prefix value allows for table prefixing of your Drupal database
  205. in the event that you run more than one site from a single database.
  206. $db_prefix can be used normally with Domain Access.
  207. However, the Domain Prefix module provides for dynamic table prefixing
  208. based on the currently active domain. If you use the Domain Prefix module
  209. you can set $db_prefix as a string value as well as an array.
  210. For more detail, see INSTALL.txt in the domain_prefix folder.
  211. ----
  212. 4.3 $cookie_domain
  213. By design, Drupal cookies are set for the current website on login. That is, if
  214. you login from www.example.com, the cookie will be set from the domain
  215. 'www.example.com.'
  216. However, a cookie from www.example.com is not valid on one.example.com.
  217. In order to provide for login across your active domains, you must set the
  218. $cookie_domain value to the string indicating your root domain.
  219. Typically, this value is '.example.com'.
  220. If your domains do not share the top-level, then you may need to login to
  221. each site separately or use a module such as Single SignOn.
  222. NOTE: After you change your cookie value, you will need to logout and
  223. log back in for the new cookie to take effect.
  224. ----
  225. 4.4 Add settings.inc
  226. For Domain Access to work, you must add some code to your settings.php
  227. file. This code will load the Domain Access bootstrap routines that determine
  228. how your site is being requested.
  229. If you do not add settings.inc to your settings.php file, Domain Access will
  230. fail to load and report an error message to site administrators.
  231. IMPORTANT: You must add these lines to settings.php after the $db_url
  232. has been set; otherwise, Drupal will fail to load. Normally, you should add
  233. these lines to the end of the settings.php file.
  234. ----
  235. 4.4.1 Installation
  236. In the Domain Access download, find the following file:
  237. domain > settings.inc
  238. You will need to load this file from inside your settings.php file. There
  239. are two methods for this.
  240. ----
  241. 4.4.2 Option 1 -- Preferred
  242. This method is preferred, since any updates to the module release
  243. will be reflected in this file.
  244. NOTE: the elements inside the ==== marks are php code that
  245. should be copied into your settings.php file. DO NOT COPY THE ==== MARKS.
  246. Add the following lines to the end of your settings.php file:
  247. ====
  248. /**
  249. * Add the domain module setup routine.
  250. */
  251. include './path/to/modules/domain/settings.inc';
  252. ====
  253. In this case, change 'path/to/modules' with the directory where your modules are
  254. stored. Typically this will be 'sites/all/modules', which makes the lines:
  255. ====
  256. /**
  257. * Add the domain module setup routine.
  258. */
  259. include './sites/all/modules/domain/settings.inc';
  260. ====
  261. ----
  262. 4.4.3 Option 2
  263. If you are having difficulty determining the correct path, copy the following
  264. files into your settings folder.
  265. domain > domain.bootstrap.inc
  266. domain > settings.inc
  267. domain > settings_custom_url.inc
  268. The files should be in the same directory as your active settings.php file.
  269. Then add the following lines:
  270. ====
  271. /**
  272. * Add the custom_url_rewrite_outbound function.
  273. */
  274. include 'settings.inc';
  275. ====
  276. ----
  277. 4.4.4 Testing Your Configuration
  278. After editing your settings.php file, go to Admin > Build > Domains. You may
  279. see a warning at the top of the page:
  280. "Domain access failed to load during phase: bootstrap include. Please check your
  281. settings.php file and site configuration."
  282. This message means that your PHP server cannot find the include file. You
  283. may need to test other path options for the include code.
  284. When this occurs, the default domain will be loaded, but custom settings or
  285. themes for other domains will not.
  286. If the module is working correctly and you are getting persistent errors due to web
  287. crawlers, you may disable this warning. To do so, edit settings.php and add the
  288. following lines to the bottom of the file:
  289. $conf['domain_hide_errors'] = TRUE;
  290. This will suppress the warning messages. See http://drupal.org/node/774692 for
  291. background.
  292. ----
  293. 4.4.5 Additional Resources
  294. If you are having trouble configuring the include, you should check your
  295. PHP include path. You may need to use an absolute path to your server root.
  296. http://us3.php.net/manual/en/ini.core.php#ini.include-path
  297. You may also copy the entire function custom_url_rewrite_outbound() directly
  298. into your settings.php file.
  299. ----
  300. 4.5 custom_url_rewrite_outbound()
  301. custom_url_rewrite_outbound() is a special function that you can add
  302. to settings.php to alter how Drupal writes links to content.
  303. Domain Access implements this function within the context of the
  304. URL Alter module, http://drupal.org/project/url_alter, which is a
  305. functional backport of changes implemented in Drupal 7.
  306. If your site uses custom code to implement custom_url_rewrite_outbound(),
  307. consider upgrading to the URL Alter module for full compatibility.
  308. You may also call the function domain_url_rewrite_outbound() directly in
  309. your custom code.
  310. NOTE: Domain Access does not use custom_url_rewrite_inbound().
  311. For more information, see
  312. http://api.drupal.org/api/function/custom_url_rewrite_outbound/6
  313. http://drupal.org/node/450344
  314. http://drupal.org/node/529026
  315. ----
  316. 5. Additional Module Installation
  317. The Domain Access module includes several sub-modules. Two of these
  318. have their own INSTALL.txt instructions.
  319. ----
  320. 5.1 Domain Strict
  321. While this module requires no additional installation, it fundamentally
  322. changes the behavior of the Domain Access module.
  323. Under Domain Strict, only authenticated users (those who have registered)
  324. are given any domain-specific privileges.
  325. Anonymous users will only be able to view content that is assigned to "all
  326. affiliates."
  327. As a result, enabling this module may cause content to disappear from your
  328. site for users who are not logged in. This is by design.
  329. Refer to domain > domain_strict > README.txt
  330. ----
  331. 6. Uninstalling
  332. When you disable this module, it will reset your {node_access} tables and
  333. remove all records from the {domain_access} table. This will remove all
  334. access rules associated with this module.
  335. You may then uninstall the module normally.
  336. You should also revert the patches that you applied and remove
  337. any extra code from your settings.php file.
  338. To revert a patch, see http://drupal.org/patch/reverse