Category Archives: Web Servers

Converting from a RHEL install to a CentOS install

A couple of days ago I received a RHEL (Red Hat Enterprise Linux) Virtual Machine image from our IT support team. The problem was that the image was made using an evaluation copy of Red Hat. I figured I would convert it to CentOS, since there is no registration required. Here is what I did, and maybe it will help you if you need to upgrade a server with an expired subscription. From the root of your filesystem:

#yum clean all
#mkdir /usr/src/centos
#cd /usr/src/centos
#rpm --import RPM-GPG-KEY-CentOS-5
#/bin/rpm -e --nodeps redhat-release
#/bin/rpm -e --nodeps rhn-client-tools
#/bin/rpm -e --nodeps yum-rhn-plugin
#rpm -Uvh --force *.rpm
#yum upgrade

That should do the trick!


Using Phabricator with NginX

Phabricator 1 is a suite of software project management tools, developed by Facebook. Currently, the project is still in an early testing stage, but seems stable enough to use for small projects.

This set of tools were developed to be used on a web server running Apache. I ditched Apache a couple of years ago in favor of NginX, and as a result, had to convert a few configurations from Apache to NginX. This is how I made Phabricator work on NginX:

Installing Phabricator 2

$ cd webroot/ # pick some install directory
webroot/ $ git clone git://
webroot/ $ git clone git://
webroot/ $ git clone git://
webroot/ $ cd phabricator
webroot/phabricator/ $ git submodule update --init
webroot/phabricator/ $ cd ..

Preparing the Database
After checking out the code from Git, you have to set up the database

webroot/ $ mysql -uroot < phabricator/resources/sql/init/initialize.sql

Configuring Phabricator 3
Create a new configuration file with the same name that will identify this installation, for example:

webroot/ $ vim phabricator/conf/custom/myconfig.conf.php

Then add the following array to the config file:


  // This will be the base domain for your install, and must be configured.
  // Use "https://" if you have SSL. See below for some notes.
  'phabricator.base-uri' => '',

  // Connection information for MySQL.
  '' => 'localhost',
  'mysql.user' => 'root',
  'mysql.pass' => 'trustno1hunter2',

  // Basic email domain configuration.
  'metamta.default-address' => '',
  'metamta.domain'          => '',

  // NOTE: Check default.conf.php for detailed explanations of all the
  // configuration options, including these.

) + phabricator_read_config_file('production');

Configure NginX
This is where the installation differs from what they show you on the Phabricator website.
At a minimum, you will need the code below:

  1. Add a rewrite rule if a file for the request does not exist. We need this, because Phabricator makes use of AJAX requests
  2. You have to rewrite the URL to index.php?__PATH__=/$1
  3. Phabricator requires an environment (PHABRICATOR_ENV) to be set for this install. It will point to the custom config file you created earlier, but without the .conf.php part.
  4. Phabricator needs the SCRIPT_FILENAME, QUERY_STRING, REQUEST_METHOD, and REMOTE_ADDR to be set in order to work.
    1. Depending on your setup, you will want to add this to a custom conf file, or to the nginx conf file:

      server {
          root     /webroot/phabricator;
          try_files $uri $uri/ /index.php;
          location / {
              index   index.php;
              if ( !-f $request_filename )
                  rewrite ^/(.*)$ /index.php?__path__=/$1 last;
          location ~ .php$ {
              fastcgi_pass   localhost:9000;
              fastcgi_index   index.php;
              #custom environment variable
              fastcgi_param PHABRICATOR_ENV     "custom/myconfig";
              #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;

      Test your install
      You will have to restart NginX to see the new configuration for Phabricator.

      webroot/phabricator/ $ service nginx force-reload

      If NginX restarted without any problems, open your browser and go to the server address you specified in the nginx server configuration file (server_name). In this case, it is

      Follow the on screen instructions.
      When the installation is done, you have to update the database schema and create an admin user account.

      Updating the Database schema 4
      Back in your terminal, enter the following: (Replace config/myconfig with your Phabricator environment)

      webroot/phabricator/ $ PHABRICATOR_ENV=config/myconfig scripts/sql/upgrade_schema.php

      Creating an admin user account 5
      The final step is to create your admin user account. Again, you will have to run a script for this:

      webroot/phabricator/ $ PHABRICATOR_ENV=config/myconfig bin/accountadmin

      That should do it. You can now go back to your browser and log in.