Phabricator配置向导

怎甘沉沦 提交于 2019-11-27 18:26:17

配置向导

该文档包含了Phabricator所需的最基本的配置指引。

前提

该文档假定你已经安装了所有必需的组件。如果没有,请查看安装向导。

下一步:

  • 配置你的webserver(Apache,nginx或lighttpd)
  • 通过浏览器访问Phabricator
  • 按照指引完成设置

WEB服务器:配置Apache

注意:下面是Apache配置指引。如果使用nginx或lighttpd,请滑动到其相应部分。

运行Apache,并使用一个测试页来验证其是否正常工作。如果有问题,请查看Apache的帮助文档。确保mod_php和mod_rewrite启用,如果你设置SSL,请开启mod_ssl模块。

如果你还没有设置一个域名指向你将要安装的主机上。你可以安装Phabricator到一个二级域名(如phabricator.example.com)上或一个完整域名上,但你不能安装到一个已经存在的网站的某个子目录下。输入你将要安装到的域名以确保Apache可以为其正常服务,并且DNS已经正确配置。

注意:域名必须包含点(.),而不只是一个名称,如http://example/。否则,一些web浏览器将无法设置cookies。

现在,可以创建一个VirtualHost条目(放置Phabricator到一个二级域名上)或编辑Directory条目的DocumentRoot。将如下所示:


httpd.conf

<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中

<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.

下一步

继续:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!