Thursday, May 29, 2014

Fronting WSO2 Management Console UI with Nginx

I'm going to set up WSO2 API Manager & WSO2 BAM in Linux environment for this exercise.

Since I'm going to run both products within a single machine need following configuration change,

1. Update port offset configuration as follows within <BAM_HOME>/repository/conf/carbon.xml.
<Offset>1</Offset>
 For API Manager I'm going to use the default configurations.

2. Update /etc/hosts with following and update IP address according to your environment.
10.100.0.128 am.wso2.org
10.100.0.128 bam.wso2.org
 3. Use following configuration within Nginx and update  proxy_pass according to your environment.

server {
    listen 443;
    server_name am.wso2.org;
    ssl on;
        ssl_certificate /etc/nginx/ssl/server.crt;
        ssl_certificate_key /etc/nginx/ssl/server.key;

    location /carbon {
            index index.html;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass https://10.100.0.128:9443;
        }
    location /t {
            index index.html;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass https://10.100.0.128:9443;
        }
 }

server {
    listen 443;
    server_name bam.wso2.org;
    ssl on;
        ssl_certificate /etc/nginx/ssl/server.crt;
        ssl_certificate_key /etc/nginx/ssl/server.key;

    location /carbon {
            index index.html;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass https://10.100.0.128:9444;
        }
    location /t {
            index index.html;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass https://10.100.0.128:9444;
        }
 }


So in this configuration I'm having two server directives, one for API Manager and one for BAM.

Read this post if you need help on creating SSL certificates.

I'm done with the configuration now, lets browse our management console now.

If you type https://am.wso2.org/carbon you will get the API Manager Admin Console UI.

 
After logging using defualt username:admin ,password:admin you may create a new tenant using Home > Configure > Multitenancy > Add New Tenant.

Now try to log-in to that tenant. You will get the following,



Ok, Let's try the BAM admin console now. Browse https://bam.wso2.org/carbon ,


Log-in, create a tenant and try to login using those tenant credentials.


Hope this will help to configure any WSO2 Product with Nginx !!