注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

John's Blog

天空,有梦就可以飞翔!

 
 
 

日志

 
 
关于我

刚走出校园的毕业生,就读计算机网络专业,对网站建设有一定的基础。开始探求Drupal已有一段时间,对Drupal的发展很是看好。现就职于深圳慧衡科技有限公司(intematrix.cn),它是一家专门服务于中国及海外中小企业的网络营销分析和优化服务提供商。 QQ交流群:44581272

网易考拉推荐

Drupal多站点:How To Setup A Drupal Multisite On Windows  

2009-11-10 21:07:45|  分类: drupal学习 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

A few people have requested me to write an article on setting up a Drupal multisite installation on Windows. Note that this discussion is adapted from a previous article I wrote which explained how to do this on shared hosting environments on cPanel.

Prerequisites

Some things to consider before I get started. I assume you have installed your entire WAMP stack (Windows, Apache, MySQL, and PHP) on a local development system and are ready to proceed installing Drupal. If you like more information on how to do this, read How To Setup A WAMP Development Environment. Although I do not have access to Windows 2003/Windows 2008 server, the instructions here should apply.

In summary:

  • Windows XP SP 3 or better
  • Apache HTTP Server 2.x
  • MySQL 5.x Server
  • MysQL GUI Tools For Windows
  • PHP 5.2.x Server

Requirements

Before installing Drupal on your local system, please make sure you have the following settings:

  • mod_rewrite enabled
  • PHP XML extension enabled
  • PHP mysqli extension enabled
  • PHP GD extension enabled
  • safe mode off
  • register_globals off

Download Drupal And Copy To Web Server Directory

  • Download the latest Drupal release and copy it to a temporary directory (c:/temp)
  • Use WinRar and decompress the targ.gz file in the temp directory
  • Copy all the files to the root of your Apache server (c:/apache/htdocs)

Create MySQL database

  • Run the MySQL Administrator program which is part of the MySQL GUI Tools. To launch it, look in the Start | MySQL menu. Login with the following information:
    DE<Server Host: localhost
    Port: 3306
    Username: root
    Password: your password hereDE<
  • Click on the Catalogs icon. Right click in the Schemata area and select Create New Schema and give it the name drupal_mysite1 to create the database.
  • Next, click on User administration and then right click on the User Accounts area. Click on the Add new user option and enter in as MySQL user the name 'drupal_admin' and the password 'password'. Hit the Apply changes button.
  • Click on the Schema Privileges tab for drupal_admin and assign all privileges to the drupal_mysite1 schemata.

We have created a new MySQL database and a drupal database administrator account. The administrator was granted all access privileges.

DE<Database name: drupal_mysite1
Username: drupal_admin
Password: passwordDE<

Install Drupal

You are now ready to install Drupal. Fire up your browser and type in the URL to your site.

  • Select English language (or another)
  • If a message comes up about settings.php, follow the directions
  • Enter in your database information as we set it up from above
  • Configure Drupal to your sites' settings

Installing Additional Websites

The same steps above are repeated for adding additional domains to your server.

  1. Add the domain to the /windows/system32/drivers/etc/hosts file
    DE<127.0.0.1 localhost
    127.0.0.1 www.mysite1.com www.mysite2.com
    127.0.0.1 imysite1.com imysite2.comDE<
  2. Add to your apache httpd-vhosts.conf file the virtual host:
    DE<<VirtualHost *:80>
      ServerName www.mysite1.com
      ServerAlias mysite1.com
      DocumentRoot "c:/apache/htdocs/"
      ErrorLog "logs/mysite1.com-error.log"
      CustomLog "logs/mysite1.com-access.log" common
    </VirtualHost>
    <VirtualHost *:80>
      ServerName www.mysite2.com
      ServerAlias mysite2.com
      DocumentRoot "c:/apache/htdocs/"
      ErrorLog "logs/mysite2.com-error.log"
      CustomLog "logs/mysite2.com-access.log" common
    </VirtualHost>DE<

    Notice the setting of the DocumentRoots. They both share c:/apache/htdocs/. In a standard virtual host setup, it would look something like this:

    DE<<VirtualHost *:80>
      ServerName www.mysite1.com
      ServerAlias mysite1.com
      DocumentRoot "c:/apache/htdocs/mysite1.com/"
      ErrorLog "logs/mysite1.com-error.log"
      CustomLog "logs/mysite1.com-access.log" common
    </VirtualHost>
    <VirtualHost *:80>
      ServerName www.mysite2.com
      ServerAlias mysite1.com
      DocumentRoot "c:/apache/htdocs/mysite2.com/"
      ErrorLog "logs/mysite2.com-error.log"
      CustomLog "logs/mysite2.com-access.log" common
    </VirtualHost>DE<

    The magic is provided by Drupal which uses index.php as a boot strap loader along with its own .htaccess to service all Drupal installed websites. It is also the reason why the DirectoryIndex index.php setting in httpd.conf is so important.

  3. Create another MySQL database
    DE<mysql> show databases;
    mysql> create database drupal_mysite2;
    mysql> use mysql;
    mysql> grant all privileges on drupal_mysite2 to 'drupal_admin'@'localhost' identified by 'password';DE<
  4. Copy /sites/default/default.settings.php to /sites/mysite2.com/settings.php (note it ends in dot com very important!)
  5. Install Drupal

Thats pretty much it in a nutshell. Of course there is a lot of other neat stuff you can do so I'll leave it open here for another day.

Happy Drupaling!

P.S.

If you don't want to go through the hassle of figuring out if your host meets Drupal requirements and wasting time troubleshooting, use Hostgator. This site happens to be on HostGator and is running Drupal. I've used them throughout the years. Hostgator is affordably priced and very good on support.

If you sign up using Hostgator please use the banner above as we are a Hostgator affilliate. We use the ad revenue to run this website. And if you don't mind please contact me if you have done so. Thank you.

  评论这张
 
阅读(414)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2016