Search code examples
apachedrupalvirtualdrush

Drush with several Virtual Hosts on Apache web server


I have several Drupal installs on an Apache2 Web server. Each install is a separate virtual host on the Document Root, like

/var/www/html/site-1
/var/www/html/site-2
/var/www/html/site-3

...

I want to perform Drush commands just on "site-1", for example install a module. In order to do that just for "site-1", should i do the following?

1.) cd /var/www/html/site-1/sites/all/modules 2.) drush en module_name -y

Will the above download and enable "module_name" only for "site-1"?

Thanks!


Solution

  • You might want to use the option --rootto specify the webroot of your drupal installation. You can also specify the website URL using the option --uri, if you have a multisite installation. Look at http://docs.drush.org/en/master/usage/#options for an in-depth description.

    But the best way to handle you setup is drush aliases (http://docs.drush.org/en/master/usage/#site-aliases). You define an alias @site1 etc. and this alias references the webroot and site URL (and optionally other parameters as well).