You are here

INSTALL.txt in Domain Access 7.2

Same filename and directory in other branches
  1. 5 INSTALL.txt
  2. 6.2 INSTALL.txt
  3. 7.3 INSTALL.txt

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