Remove current installation of Nginx
sudo apt-get purge nginx nginx-common nginx-full
Install Nginx
sudo apt-get install nginx
Edit configurations
sudo vi /etc/nginx/sites-enabled/default
Create ssl certificates and copy then to ssl folder.
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
Sample configuration:
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
location /apimanager/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://localhost:9443/carbon/;
proxy_redirect https://localhost:9443/carbon/ https://localhost/apimanager/carbon/;
proxy_cookie_path / /apimanager/carbon/;
}
location /apimanager/publisher/registry {
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://localhost:9443/registry;
proxy_redirect https://localhost:9443/registry https://localhost/apimanager/publisher/registry;
proxy_cookie_path /registry /apimanager/publisher/registry;
}
location /apimanager/publisher {
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://localhost:9443/publisher;
proxy_redirect https://localhost:9443/publisher https://localhost/apimanager/publisher;
proxy_cookie_path /publisher /apimanager/publisher;
}
location /apimanager/store {
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://localhost:9443/store;
proxy_redirect https://localhost:9443/store https://localhost/apimanager/store;
proxy_cookie_path /store /apimanager/store;
}
}
To stop start us following commands
sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx stop
API Manager configurations
Add following API Manager configurations:
In API store edit wso2am-1.8.0/repository/deployment/server/jaggeryapps/store/site/conf/site.json file and add following.
"reverseProxy" : {
"enabled" : true,
"host" : "localhost",
"context":"/apimanager/store"
}
In API publisher edit wso2am-1.8.0/repository/deployment/server/jaggeryapps/publisher/site/conf/site.json file and add following.
"reverseProxy" : {
"enabled" : true,
"host" : "localhost",
"context":"/apimanager/publisher",
}
Edit /repository/conf/carbon.xml and update following properties.
Then start API Manager.
Server URLs would be something like this
https://localhost/apimanager/store
https://localhost/apimanager/publisher
sudo apt-get purge nginx nginx-common nginx-full
Install Nginx
sudo apt-get install nginx
Edit configurations
sudo vi /etc/nginx/sites-enabled/default
Create ssl certificates and copy then to ssl folder.
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
Sample configuration:
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
location /apimanager/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://localhost:9443/carbon/;
proxy_redirect https://localhost:9443/carbon/ https://localhost/apimanager/carbon/;
proxy_cookie_path / /apimanager/carbon/;
}
location /apimanager/publisher/registry {
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://localhost:9443/registry;
proxy_redirect https://localhost:9443/registry https://localhost/apimanager/publisher/registry;
proxy_cookie_path /registry /apimanager/publisher/registry;
}
location /apimanager/publisher {
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://localhost:9443/publisher;
proxy_redirect https://localhost:9443/publisher https://localhost/apimanager/publisher;
proxy_cookie_path /publisher /apimanager/publisher;
}
location /apimanager/store {
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://localhost:9443/store;
proxy_redirect https://localhost:9443/store https://localhost/apimanager/store;
proxy_cookie_path /store /apimanager/store;
}
}
To stop start us following commands
sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx stop
API Manager configurations
Add following API Manager configurations:
In API store edit wso2am-1.8.0/repository/deployment/server/jaggeryapps/store/site/conf/site.json file and add following.
"reverseProxy" : {
"enabled" : true,
"host" : "localhost",
"context":"/apimanager/store"
}
In API publisher edit wso2am-1.8.0/repository/deployment/server/jaggeryapps/publisher/site/conf/site.json file and add following.
"reverseProxy" : {
"enabled" : true,
"host" : "localhost",
"context":"/apimanager/publisher",
}
Edit /repository/conf/carbon.xml and update following properties.
<HostName>localhost</HostName>
<MgtHostName>localhost</MgtHostName>
Then start API Manager.
Server URLs would be something like this
https://localhost/apimanager/store
https://localhost/apimanager/publisher