部署Phabricator时,根据官网的教程安装和配置之后发现并不能正常访问Phabricator.
几经周折,最终成功部署上Phabricator,以下是部署的步骤:
1. 安装Phabricator
到官网下载phabricator , libphutil和arcanist. 在部署成功后phabricator会去访问这两个文件夹,所以这三个文件夹请放到相同文件目录下.
$ cd somewhere/ # pick some install directory somewhere/ $ git clone https://github.com/phacility/libphutil.git somewhere/ $ git clone https://github.com/phacility/arcanist.git somewhere/ $ git clone https://github.com/phacility/phabricator.git
2. 安装php5-fpm
在ubuntu下安装
sudo apt-get install php5-fpm
3. 安装Nginx
在Ubuntu下安装
sudo apt-get install nginx
4. 配置nginx下phabricator的配置文件, 这里我们叫做phabricator.conf
切换到目录 /etc/nginx/site-available/ 并创建phabricator.conf文件
将以下内容粘贴到phabricator.conf文件中.(内容跟官网上的配置文件不同)
server { listen 9005; #可修改成自己想要的端口号 server_name 127.0.0.1; #改成自己的IP, 127.0.0.1 或者localhost root /path/to/phabricator/webroot; #请改成你个人电脑上的phabricator/webroot路径 client_max_body_size 75M; index index.php; rewrite ^/(.*)$ /index.php?__path__=/$1 last; #这一行必须要, Phabricator会判断__path__的值,不设置会报错 location /favicon.ico { try_files $uri = 204; } location / { try_files $uri $uri/ =404; } # 将PHP 脚本传给 FastCGI server listening on 127.0.0.1:9000. 这部分内容在/etc/nginx/site-avaiable/default.conf里面可以找到 location ~\.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# with php5-cgi alone: #fastcgi_pass 127.0.0.1:9000; # with php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock; #使用php5-fpm一定要用这个配置,否则会报错502 fastcgi_index index.php; include /etc/nginx/fastcgi_params; }
5. 启动php5-fpm
sudo /etc/init.d/php5-fpm start
如果一上来使用 sudo service php5-fpm start可能会失败, 使用前面的那个命令成功之后再用service命令就不会有问题.
6. 启动nginx
sudo /etc/init.d.nginx start
7. 访问一下127.0.0.1:9005看下效果.
如果你没有安装mysql或者mysqli, phabricator会提示你进行安装.
在ubuntu下
sudo apt-get install php5-mysqlnd #使用php5-mysql安装会失败
8. 进行下一步
进行phabricator文件夹, 在ubuntu 终端下运行 ./bin/storage upgrade
请确保数据库MySQL是开启的, 这样数据库中就会生成phabricator相关的数据库和表.
部署基本结束,可以成功进行访问并进行下一步动作了.