<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Sealyu

    --- 博客已遷移至: http://www.sealyu.com/blog

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評(píng)論 :: 0 Trackbacks

    There are two methods for setting up Drupal 5.x/6.x with Apache on Ubuntu. The first (preferred) method edits the virtual host configuration, which is the default setup on Ubuntu (even for a single-site web server). The second edits the main apache2.conf, which is typical for an older setup.

    Step 1 - Method A: "Virtual Host" Setup

    First, from the Linux command line, enable the rewrite module for apache with this command:

    sudo a2enmod rewrite

    You can check to see if this worked by running:

    apache2ctl -M

    and seeing if it is on the list.

    Next, use an editor (such as nano) to edit the appropriate Apache configuration file for your Drupal site in the /etc/apache2/sites-available/ directory. For a single site, the file is /etc/apache2/sites-available/default; if you have multiple sites, the file names should reflect the names of the sites to which they refer. Thus, to edit the default site configuration, use

    sudo nano /etc/apache2/sites-available/default

    Look for the Directory section referring to the folder where your Drupal site lives (in /etc/apache2/sites-available/default, this is typically <Directory /var/www>), and change the line:

    AllowOverride None to AllowOverride All

    (This directive permits an .htaccess file, such as Drupal's, to be used to override Apache's default settings, and is necessary to allow the URL rewriting to work. See https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles for more information).

    Save this file and then reload Apache as follows:

    sudo /etc/init.d/apache2 reload

    Subdomain Setup

    Instead of creating multiple virtual host files, you can create one virtual host file that uses a wildcard in the ServerAlias. Both a simple multi-site Drupal setup and multiple Drupal versions can run this way, if the different subdomains are defined for each site in settings.php.

    Consider the following and modify your configuration file to fit your needs.

    1. http://myproject.dr5.example/
    2. http://myproject.dr6.example/
    3. http://myproject2.dr6.example/

    Here is a partial listing of a virtual host configuration file that would support the last two lines in the above example. Note this is not intended to be a COMPLETE configuration file, but rather provide guidance for your development setup.

    <VirtualHost *>
    DocumentRoot "/www/Dr6"
    ServerName example
    ServerAlias *.dr6.example

    <Directory "/www/Dr6">
    AllowOverride All
    </Directory>

    Edit & save your config file to suit your development needs. Assuming the site is already enabled, then reload Apache.

    Step 1 - Method B: apache2.conf

    In Apache version 2, httpd.conf has been deprecated and the new file is located at:
    /etc/apache2/apache2.conf.

    Thus, it's no longer necessary to do the following in httpd.conf to enable the rewrite module (mod_rewrite):

    LoadModule rewrite_module modules/mod_rewrite.so
    AddModule mod_rewrite.c

    Simply run the following from the Linux command line:
    sudo a2enmod rewrite

    To disable the module you can run:
    sudo a2dismod rewrite
    (Note that this would cause clean URLs to break.)

    Once mod_rewrite is enabled, open apache2.conf in a text editor. Note that it will probably be read-only, so you will need sudo privileges to edit it. Use a command such as:
    sudo nano /etc/apache2/apache2.conf

    Find where the sections are in your apache2.conf and add another one for your Drupal site similar to this:

    <Directory /var/www/your_drupal_site>
        AllowOverride All
    </Directory>

    After you edit apache2.conf as listed above, you need to restart the server by:
    sudo /etc/init.d/apache2 reload

    Step 1 - Method C: Add Rewrite Rules Directly to Virtual Host or apache2.conf

    If you do not wish to allow .htaccess overrides, you can add the rewrite rules directly to a virtual host file or apache2.conf. The following should work:

    <Directory /var/www/your_drupal_site>
             RewriteEngine On
             RewriteBase /
             RewriteCond %{REQUEST_FILENAME} !-f
             RewriteCond %{REQUEST_FILENAME} !-d
             RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
          </Directory>

    This can provide slightly faster server performance since Apache will not look in every directory for an .htaccess file.

    Note that, for proper security, you will need to add in the rules from the Drupal files directory's .htaccess file as well.

    Debugging Rewrite Issues

    If you are having problems with getting your rewrite to work you can set Apache to log rewrite errors. To do that add this to the end of /etc/apache2/apache2.conf:

    RewriteLog "/var/log/apache2/rewrite.log"
    RewriteLogLevel 3

    Level 0 does no logging. Level 9 logs everything. Choose the level necessary for resolving your issue.

    Security Warning: Make sure to either remove or comment the logging code out when finished, or else put the log file in a directory that can't be read by normal users (such as /var/log/apache2). If this is not done, it can result in a security breach. Also, note that rewrite logging adds somewhat to server load, and can easily generate large amounts of output not needed on a production server.

    Step 2: Enable Clean URLs

    Now go to http://yoursite.com/?q=admin/settings/clean-urls, and run the test for "Clean URLs" (In Drupal 4.6 - 5.x this is buried in the paragraph explaining what "clean urls" are).

    Then, select the radio button to set clean URLs to "enabled" and submit the form. You should now be able to access your site using URLs without the query string in them.

    posted on 2010-08-19 09:32 seal 閱讀(582) 評(píng)論(0)  編輯  收藏 所屬分類: PHP
    主站蜘蛛池模板: 久久亚洲AV午夜福利精品一区| 一级毛片在线免费视频| 男女啪啪免费体验区| 亚洲国产精品国自产拍电影 | 亚洲精品成人av在线| 国产一级一片免费播放| 色多多A级毛片免费看| 亚洲宅男精品一区在线观看| 亚洲av午夜成人片精品网站 | 国产亚洲精品成人AA片新蒲金| 两个人看的www高清免费观看| 亚洲av中文无码字幕色不卡| 免费a级毛片视频| 性做久久久久久久免费看| 小说专区亚洲春色校园| 亚洲国产成人高清在线观看| 国产极品粉嫩泬免费观看 | 亚洲午夜一区二区电影院| 久久久无码精品亚洲日韩蜜桃| 亚洲人成网站在线观看青青| 久久久久国产免费| 国产大陆亚洲精品国产| 亚洲一卡2卡3卡4卡5卡6卡| 亚洲日韩乱码久久久久久| 亚洲精品第一国产综合精品99| 在线观看免费成人| 精品国产污污免费网站入口| 婷婷亚洲综合一区二区| 亚洲av无码无线在线观看 | 岛国精品一区免费视频在线观看 | 老司机69精品成免费视频| 日韩毛片免费一二三| 日韩在线视频播放免费视频完整版| 亚洲精品人成网线在线播放va| 狠狠色伊人亚洲综合网站色| 国产亚洲中文日本不卡二区| 亚洲欧美自偷自拍另类视| 老汉色老汉首页a亚洲| 亚洲四虎永久在线播放| 亚洲永久永久永久永久永久精品| 亚洲综合一区二区精品导航|