Phabricator配置嚮導

配置嚮導

該文檔包含了Phabricator所需的最基本的配置指引。 php

前提

該文檔假定你已經安裝了全部必需的組件。若是沒有,請查看安裝嚮導。 html

下一步: nginx

  • 配置你的webserver(Apache,nginx或lighttpd)
  • 經過瀏覽器訪問Phabricator
  • 按照指引完成設置

WEB服務器:配置Apache

注意:下面是Apache配置指引。若是使用nginx或lighttpd,請滑動到其相應部分。

運行Apache,並使用一個測試頁來驗證其是否正常工做。若是有問題,請查看Apache的幫助文檔。確保mod_php和mod_rewrite啓用,若是你設置SSL,請開啓mod_ssl模塊。 web

若是你尚未設置一個域名指向你將要安裝的主機上。你能夠安裝Phabricator到一個二級域名(如phabricator.example.com)上或一個完整域名上,但你不能安裝到一個已經存在的網站的某個子目錄下。輸入你將要安裝到的域名以確保Apache能夠爲其正常服務,而且DNS已經正確配置。 shell

注意:域名必須包含點(.),而不僅是一個名稱,如http://example/。不然,一些web瀏覽器將沒法設置cookies。

如今,能夠建立一個VirtualHost條目(放置Phabricator到一個二級域名上)或編輯Directory條目的DocumentRoot。將以下所示: 數據庫


httpd.conf apache

<VirtualHost *>
  # Change this to the domain which points to your host.
  ServerName phabricator.example.com

  # Change this to the path where you put 'phabricator' when you checked it
  # out from GitHub when following the Installation Guide.
  #
  # Make sure you include "/webroot" at the end!
  DocumentRoot /path/to/phabricator/webroot

  RewriteEngine on
  RewriteRule ^/rsrc/(.*)     -                       [L,QSA]
  RewriteRule ^/favicon.ico   -                       [L,QSA]
  RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]
</VirtualHost>

若是當前的Apache配置不能爲你所放置的Phabricator文檔目錄服務,你須要添加以下的部分到httpd.conf中 ubuntu

<Directory "/path/to/phabricator/webroot">
  Order allow,deny
  Allow from all
</Directory>

更改後,重啓Apache,而後跳轉到下面的設置步驟。 瀏覽器

WEB服務器:配置nginx

NOTE: Follow these instructions to use nginx. To use Apache or lighttpd, scroll to their sections.

For nginx, use a configuration like this: 服務器

nginx.conf

server {
  server_name phabricator.example.com;

  root      /path/to/phabricator/webroot;
  try_files $uri $uri/ /index.php;

  location / {
    index   index.php;

    if ( !-f $request_filename )
    {
      rewrite ^/(.*)$ /index.php?__path__=/$1 last;
      break;
    }
  }

  location /index.php {
    fastcgi_pass   localhost:9000;
    fastcgi_index   index.php;

    #required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param  REDIRECT_STATUS    200;

    #variables to make the $_SERVER populate in PHP
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;

    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

    fastcgi_param  REMOTE_ADDR        $remote_addr;
  }
}


Restart nginx after making your edits, then continue to "Setup" below.

WEB服務器:配置lighttpd

NOTE: Follow these instructions to use lighttpd. To use Apache or niginx, scroll up to their sections.

For lighttpd, add a section like this to your lighttpd.conf:

$HTTP["host"] =~ "phabricator(\.example\.com)?" {
    server.document-root = "/path/to/phabricator/webroot"
    url.rewrite-once = (
        "^(/rsrc/.*)$" => "$1",
        "^(/favicon.ico)$" => "$1",
        # This simulates QSA ("query string append") mode in apache
        "^(/[^?]*)\?(.*)" => "/index.php?__path__=$1&$2",
        "^(/.*)$" => "/index.php?__path__=$1",
    )
}

You should also ensure the following modules are listed in your server.modules list:

mod_fastcgi mod_rewrite

Finally, you should run the following commands to enable php support:

$ sudo apt-get install php5-cgi  # for ubuntu; other distros should be similar
$ sudo lighty-enable-mod fastcgi-php

Restart lighttpd after making your edits, then continue below.

設置

如今,輸入你設置的域名。你將會看到設置指引。文檔的餘下部分爲其餘具體設置步驟的附加說明。

存儲:配置MySQL

設置中,你須要配置MySQL。運行MySQL,驗證是否能正常鏈接。若是有問題,請參考MySQL的幫助文檔。若是MySQL正常工做,你須要加載Phabricator的模式,運行命令:

phabricator/ $ ./bin/storage upgrade

若是你配置了一個無特權的用戶以鏈接數據庫,你將不得不從新設置爲root用戶或其餘的管理員以使模式能被應用。

 

phabricator/ $ ./bin/storage upgrade --user <user> --password <password>

You can avoid the prompt the script issues by passing the --force flag (for example, if you are scripting the upgrade process).

phabricator/ $ ./bin/storage upgrade --force
NOTE: When you update Phabricator, run storage upgrade again to apply any new updates.

下一步

繼續:

相關文章
相關標籤/搜索