Pentaho+ Server Configuration In Nginx With Mutiple Domain and Same Context Name

Tenthplanet-blogs-Pentaho Server Configuration In Nginx With Mutiple Domain and Same Context Name

Below are the step to be followed for configuration of Pentaho+ BA server using Nginx with multiple domain.

Create multiple domains:
1. In the system which host Nginx, open hosts file and create two new domains with your own name. Below is the command to open hosts file.

 

 

Vi /etc/hosts
IP (Host Server IP) Domain name 1
IP (Host Server IP) Domain name 2

2. In the IP replace your Host server IP and in Domain name1 and Domain name2 replace the Domain name you wanted to create. Example: Domain name 1: Pentaho+1 Domain name 2: Pentaho+2

Vi /etc/host
IP (IP of machine which hosts Nginix) Domain name1
IP (IP of machine which hosts Nginix) Domain name2

Communication between Nginx host and Pentaho+ host:
If the Nginx server and Pentaho+ server are in same machine, skip this step. Else perform the following steps.
1. Open terminal of the machine which hosts your Pentaho+ BA system. Open the host file in the system. Below is the command to open hosts file.

2. In the IP replace your Host server IP and in Domain name1 and Domain name2 replace the Domain name you wanted to create.
Example: Domain name 1: Pentaho+1
Domain name 2: Pentaho+2

Configuration changes Nginx:
1. Locate the directory in which Nginx is saved in your system. Open the sites-available folder in Nginx through command line.

cd /etc/nginx/sites-available/

2. After navigating into the sites-available folder, Now create the file reverse-proxy.conf if it does not exist. If exists, open the reverse-proxy.conf file and copy the mentioned code lines.
3. To open reverse-proxy.conf file in command line,

vi reverse-proxy.conf

4. Copy the below code to reverse-proxy.conf file.

server {
listen 80;
server_name pentaho1;

location /pentaho/ {
add_header 'Access-Control-Allow-Origin' ''; proxy_set_header include /etc/nginx/mime.types; proxy_set_header 'Access-Control-Max-Age' 1728000; proxy_set_header 'Access-Control-Allow-Origin' '';
proxy_set_header 'Access-Control-Allow-Credentials' 'true';
proxy_set_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
proxy_set_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
proxy_set_header Host $http_host;
proxy_pass http://IP:PORT/Pentaho+/;
}
}

server {
listen 80;
server_name pentaho2;

location /pentaho/ {
add_header 'Access-Control-Allow-Origin' ''; proxy_set_header include /etc/nginx/mime.types; proxy_set_header 'Access-Control-Max-Age' 1728000; proxy_set_header 'Access-Control-Allow-Origin' '';
proxy_set_header 'Access-Control-Allow-Credentials' 'true';
proxy_set_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
proxy_set_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
proxy_set_header Host $http_host;
proxy_pass http://IP:PORT/Pentaho+/;
}
}

5. Change the pentaho1 to your 1st domain name
proxy_pass http://IP:PORT/pentaho/;

6. Change the Pentaho+2 to your 2nd domain name
proxy_pass http://IP:PORT/pentaho/;
7. Now to navigate through command line to sites-enabled folder.

cd /etc/nginx/sites-enabled/

8. Now open the reverse-proxy.conf file in command line and check if the changes we made in the reverse-proxy.conf file under sites-available folder is automatically updated in the reverse-proxy.conf under sites-enabled folder.
9. If the changes are not updated or if the reverse-proxy.conf file is not found under sites-enabled folder, then create a symbolic link for the configuration files.
10. Below is the command to create a symbolic link between sites-available and sites-enabled.

sudo ln -s /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled/

Start Nginx server:
1. If the Nginx server is not running, start the Nginx with the below command.

sudo service nginx start

2. If the Nginx is running, restart the Nginx with the below command.

sudo service nginx restart

3. Now after starting the Nginx, go to the browser and type each server name configured to nginx in each tab of the browser and /Pentaho+ with it.