1 .下載phabricator源碼
創(chuàng)建文件夾
sudo mkdir /var/www/pha
cd /var/www/pha
將源碼拉下來
sudo git clone https://github.com/phacility/libphutil.git
sudo git clone https://github.com/phacility/arcanist.git
sudo git clone https://github.com/phacility/phabricator.git
修改文件權(quán)限
cd ..
sudo chmod -R 777 pha
2.安裝Nginx
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt install -y nginx
安裝后均驶,Nginx應(yīng)自動(dòng)啟動(dòng)位谋,檢查80端口是否正常
netstat -na | grep 80
應(yīng)看到類似這樣的結(jié)果:
tcp6 0 0 :::80 :::* LISTEN
3.安裝PHP環(huán)境
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php7.1 php7.1-mysql php7.1-fpm php7.1-curl php7.1-xml php7.1-mcrypt php7.1-json php7.1-gd php7.1-mbstring
修改fpm的配置:
sudo vim /etc/php/7.1/fpm/pool.d/www.conf
文件內(nèi)容锐涯,在listen = /run/php/php7.1-fpm.sock之后加入2行:
...
; Note: This value is mandatory.
listen = /run/php/php7.1-fpm.sock
listen = 9000
listen.allowed_clients = 127.0.0.1
...
重啟PHP:
sudo service php7.1-fpm stop
sudo service php7.1-fpm start
測(cè)試配置是否生效:
netstat -na | grep 9000
如能顯示,說明fpm正常啟動(dòng):
tcp6 0 0 :::9000 :::* LISTEN
4配置Nginx
域名比如是:p.mydomain.com旱幼,那么創(chuàng)建配置文件:/etc/nginx/conf.d/p.mydomain.com.conf奉件,內(nèi)容如下:
server {
server_name p.mydomain.com; # 配置域名
root /var/www/pha/phabricator/webroot; # 配置根目錄
location / {
index index.php;
rewrite ^/(.*)$ /index.php?__path__=/$1 last;
}
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;
}
}
5安裝和配置MySQL
sudo apt-get install mysql-server
提示輸入root用戶密碼,在本例中痴鳄,密碼是:root
在phabricator目錄下(/var/www/pha/phabricator)執(zhí)行命令瘟斜,將mysql密碼設(shè)置到phabricator:
bin/config set mysql.pass 'root'
為phabricator創(chuàng)建mysql相關(guān)數(shù)據(jù)表:
sudo ./bin/storage upgrade
6設(shè)置和重啟Nginx
設(shè)置下phabricator的url:
bin/config set phabricator.base-uri 'http://p.mydomain.com'
重啟Nginx
sudo service nginx reload
修改hosts
查看本機(jī)IP地址: ifconfig
sudo vim /etc/hosts
加入內(nèi)容:
IP地址 p.mydomain.com
訪問 http://p.mydomain.com 創(chuàng)建管理員賬戶
作為管理員,訪問Auth痪寻,選擇Add Provider 螺句,然后添加 Username/Password Provider(用戶密碼注冊(cè))
7配置郵件
以QQ郵箱為例
進(jìn)入 config -> mail -> metamta.mail-adapter 選擇PhabricatorMailImplementationPHPMailerAdapter
進(jìn)入 config -> mail -> metamta.default-address 設(shè)置默認(rèn)的收發(fā)郵件地址
bin/config set phpmailer.mailer smtp
bin/config set phpmailer.smtp-host smtp.qq.com -- 和下面的 smtp-user 一致的服務(wù)器,我只試過 163的
bin/config set phpmailer.smtp-port 465 -- 確保 465端口未被防火墻 block槽华,如果不行也可試下用 25 端口
bin/config set phpmailer.smtp-protocol SSL
bin/config set phpmailer.smtp-user your@qq.com -- 你的賬號(hào)
bin/config set phpmailer.smtp-password password
設(shè)置完畢壹蔓,檢查是否可以發(fā)送郵件:
bin/mail send-test --to myname@qq.com --subject hello <README.md
能收到郵件說明配置成功
有時(shí)郵件發(fā)不出一直在隊(duì)列中,輸入命令查看狀態(tài):
bin/mail list-outbound
如果一直發(fā)不出
啟動(dòng)守護(hù)進(jìn)程:
sudo ./bin/phd start