Setting up the DNS

Now you have a working IceHrm installation under some IP address of your server. But how to assign a nice domain name to it?

The first step is to point your desired domain or sub domain to the public IP of the server you’ve installed IceHrm.

For an example, I’ve pointed the domain name demoapp.icehrm.org to the IP of the server. I’ve configured it in such a way that it supports HTTPs as well.

Update Nginx Configuration

Now we should update the nginx configuration to accept the newly created domain.

Open the site configuration that you’ve created in during the installation.

sudo nano /etc/nginx/sites-available/icehrm

Update the server_name directive from server_name _; to server_name <your_domain>;

You need to replace the <your_domain> above with the domain or subdomain pointed to the new server.

After adding your domain name to /etc/nginx/sites-available/icehrm restart the web server:

sudo nginx -t
sudo service nginx restart

Update IceHrm Config File

Open your IceHrm configuration file with a text editor. It’s located in <icehrm_path>/app/config.php.

sudo nano /var/www/icehrm/app/config.php

It should look like the following with your server IP in BASE_URL and CLIENT_BASE_URL:

<?php
ini_set('error_log', 'data/icehrm.log');

define('APP_NAME', 'Ice Hrm');
define('FB_URL', 'Ice Hrm');
define('TWITTER_URL', 'Ice Hrm');

define('CLIENT_NAME', 'app');
define('APP_BASE_PATH', '/var/www/icehrm/core/');
define('CLIENT_BASE_PATH', '/var/www/icehrm/app/');
define('BASE_URL','http://157.230.XXX.XXX/web/');
define('CLIENT_BASE_URL','http://157.230.XXX.XXX/app/');

define('APP_DB', 'icehrm');
define('APP_USERNAME', 'XXXXXXXXXXX');
define('APP_PASSWORD', 'XXXXXXXXXXX');
define('APP_HOST', 'localhost');
define('APP_CON_STR', 'mysqli://'.APP_USERNAME.':'.APP_PASSWORD.'@'.APP_HOST.'/'.APP_DB);

//file upload
define('FILE_TYPES', 'jpg,png,jpeg');
define('MAX_FILE_SIZE_KB', 10 * 1024);

Replace the values of BASE_URL and CLIENT_BASE_URL with your domain name. For this example, I’ve updated my file to replace the IP with demoapp.icehrm.org.

define('BASE_URL','https://demoapp.icehrm.org/web/');
define('CLIENT_BASE_URL','https://demoapp.icehrm.org/app/');

That’s it, now your IceHrm is under your company domain or subdomain.