phabricator setup in Ubuntu 18.04

sudo su

# 시스템 업그레이드
apt-get update && apt-get dist-upgrade -y

# 한국어 로케일 추가
vim /etc/locale.gen  #comment out: ko_KR.UTF-8

# 여기서 로그아웃 한 후에, 다시 로그인

# 최신 Emacs PPA 추가 (선택사항)
add-apt-repository ppa:kelleyk/emacs && apt-get update && apt-get install emacs26-nox -y
git clone ~/.emacs.d

# 기본 유틸리티 설치
apt-get install build-essential git tig fish zsh mosh bash imagemagick sendmail -y

# 최신 NodeJS 설치 (선택 사항) - NVM 사용을 추천
curl -sL -o
apt-get install nodejs -y

# MariaDB 설치
apt-get install mariadb-server -y

# root password 설정
mysql mysql

# root ID를 사용하지 말 것. 
grant all privileges on *.* to 'dba'@'localhost' identified by 'password';

# nginx & php-fpm 설치
apt-get install nginx php7.2-fpm php7.2-mbstring php7.2-curl php7.2-mysql php-apcu php7.2-fpm git-lfs php7.2-gd php7.2-xml -y

# Phabricator 소스 설치
mkdir -p /var/www/phabricator
cd /var/www/phabricator
git clone
git clone
git clone
mkdir -p {storage,repository}
mkdir -p /var/log/phabricator
chown -R www-data:www-data /var/www/phabricator
chown -R www-data:www-data /var/log/phabricator

# Phabricator 초기 데이타베이스 생성
cd phabrciator
./bin/config set ''
./bin/config set mysql.user 'dba'
./bin/config set mysql.pass 'password'
./bin/storage upgrade

# 각종 추가 설정
./bin/config set pygments.enabled true
./bin/config set storage.local-disk.path '/var/www/phabricator/storage'
./bin/config set repository.default-local-path '/var/www/phabricator/repository'
./bin/config set phd.user 'www-data'
./bin/config set phd.log-directory '/var/log/phabricator'
./bin/config set phd.user 'www-data'
./bin/config set '/var/log/phabricator'
./bin/config set phabricator.base-uri ''
./bin/config set diffusion.allow-git-lfs  true
./bin/config set environment.append-paths '["/usr/local/bin","/usr/lib/git-core","/usr/bin"]'

# NginX 설정

# PHP7.2-FPM 설정 변경사항
sudo vim /etc/php/7.2/fpm/php.ini
  date.timezone = Asia/Seoul
  post_max_size = 128M

# MariaDB 설정 조정
sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf  

   sql_mode        = STRICT_ALL_TABLES  #line 23번 부근에 추가

# systemd 서비스로 등록
systemctl enable php7.2-fpm
systemctl enable nginx
systemctl enable mysql



# NginX/phabricator 설정
upstream php {
  server unix:/run/php/php7.2-fpm.sock;
server {
  root /var/www/phabricator/phabricator/webroot;
  access_log  /dev/null;
  #error_log  /dev/null;
  #access_log /var/log/nginx/phabricator-access.log;
  error_log   /var/log/nginx/phabricator-error.log;

  # disable any limits to avoid HTTP 413 for large image uploads
  client_max_body_size 0;

  location / {
    expires max;
    index index.php;
    rewrite ^/(.*)$ /index.php?__path__=/$1 last;

  location = /favicon.ico {
    try_files $uri =204;

  location = /ws/ {
    proxy_pass http://phabricator_websocket_pool;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    #proxy_read_timeout 999999999;

  location /index.php {

    include fastcgi.conf;
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    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;



map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;



upstream phabricator_websocket_pool {



if [[ ! -e "/var/log/phabricator" ]]; then
   mkdir -p /var/log/phabricator
chown -R www-data:www-data /var/log/phabricator

/var/www/phabricator/phabricator/bin/phd stop --force
exec sudo -En -u 'www-data' -- /var/www/phabricator/phabricator/bin/phd start