awskong

Configure Kong for a production environment

By default, the Kong proxy server works at ports 8000 and 8443. In production environments it is desirable to change these ports to 80 and 443, respectively. In order to do so, you can follow these steps:

  • Stop Kong:

      $ sudo /opt/bitnami/ctlscript.sh stop kong
    
  • Modify /opt/bitnami/apps/kong/conf/kong.conf by changing these contents:

      proxy_listen = 0.0.0.0:80
      proxy_listen_ssl = 0.0.0.0:443
    
  • Remove the following line in /opt/bitnami/apps/kong/conf/kong_nginx.tmpl:

      include /opt/bitnami/apps/bitnami/banner/conf/infopage.conf;
    
  • Restart Kong:

      $ sudo /opt/bitnami/ctlscript.sh restart kong
    

After this change, Kong’s API will work at ports 80 and 443 instead of 8000 and 8443. Therefore, the curl command that can be seen in Kong’s API Forward Example would change from:

$ curl -i -X GET \
  --url http://localhost:8000/ \
  --header 'Host: example.com'

To:

$ curl -i -X GET \
  --url http://localhost/ \
  --header 'Host: example.com'

If you want to restore the original setup, then change both /opt/bitnami/apps/kong/conf/kong.conf and /opt/bitnami/apps/kong/conf/kong_nginx.tmpl to their original contents.

Last modification December 21, 2022