【ubuntu 18.04】安装Nginx1.14+php7.2+phabriator环境


1. 官网文档

https://secure.phabricator.com/book/phabricator/article/configuration_guide/

2. 安装nginx

sudo apt-get install dpkg-dev 
sudo apt-get install nginx

3. 安装php7.2及支持扩展

sudo apt-get install php php-mysql php-gd php-curl php-apcu php-cli php-json php-mbstring
# 启动支持模块
sudo a2enmod proxy_fcgi setenvif sudo a2enconf php7.2-fpm sudo a2enmod rewrite # sudo a2enmod rewrite sudo systemctl reload nginx
master@master:/etc/nginx$ dpkg --get-selections|grep php
php                        install
php-apcu                    install
php-apcu-bc                    install
php-cli                        install
php-common                    install
php-curl                    install
php-gd                        install
php-json                    install
php-mbstring                    install
php-mysql                    install
php7.2                        install
php7.2-cli                    install
php7.2-common                    install
php7.2-curl                    install
php7.2-fpm                    install
php7.2-gd                    install
php7.2-json                    install
php7.2-mbstring                    install
php7.2-mysql                    install
php7.2-opcache                    install
php7.2-readline                    install
master@master:/etc/nginx$ dpkg --get-selections|grep nginx
libnginx-mod-http-geoip                install
libnginx-mod-http-image-filter            install
libnginx-mod-http-xslt-filter            install
libnginx-mod-mail                install
libnginx-mod-stream                install
nginx                        install
nginx-common                    install
nginx-core                    install

相关模块及依赖

4. 安装mysql5.7

sudo apt-get install mysql-server 

5. 安装git

sudo apt-get install git

6. 拉取项目

cd ~
# git clone https://github.com/phacility/libphutil.git # 新版不需要 git clone https://github.com/phacility/arcanist.git git clone https://github.com/phacility/phabricator.git

7. 配置Apache配置

sudo vim /etc/nginx/sites-enabled/default

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
        listen 9001 default_server;
        listen [::]:9001 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
        #       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#       listen 80;
#       listen [::]:80;
#
#       server_name example.com;
#
#       root /var/www/example.com;
#       index index.html;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}
server {
        listen 8888;
        listen [::]:8888;
        server_name localhost;
        root        /home/master/phabricator/phabricator/webroot;

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

        location /index.php {
                #fastcgi_pass   localhost:9000;
                fastcgi_pass   unix:/var/run/php/php7.2-fpm.sock;
                fastcgi_index   index.php;
                include        /etc/nginx/fastcgi_params;

                #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;
        }
}

# 9001是由于80端口冲突修改的

# 重点是如下,不然会报502:

fastcgi_pass   unix:/var/run/php/php7.2-fpm.sock; 

8. 重启服务生效配置

sudo service nginx restart
sudo /etc/init.d/php7.2-fpm restart

9. 访问http://127.0.0.1:8888/ 初始化配置


# 配置数据库
sudo ./bin/config set mysql.host 127.0.0.1
sudo ./bin/config set mysql.user root
sudo ./bin/config set mysql.pass 123456
# 初始化数据库
sudo ./bin/storage upgrade

10. 设置初始管理员账号

11. 启动认证 Username/Password

12. 重新注册用户

 手动修改数据库isAprroved为1即可登录

问题1:管理员设置后,注销了,有没启用认真和注册功能,怎么重新登录

./bin/auth recover