I’m having trouble enabling Kong to enable the SSL admin and proxy ports. I’m running Kong under Docker using the mashape 0.13.0 image. I’m starting the Kong container using
docker run
-d
–link kong_db:kong_db
-p 80:80
-p 443:443
-p 8001:8001
-p 8443:8443
-e KONG_DATABASE=postgres
-e KONG_PG_HOST=api-gateway-database
-e KONG_PG_PASSWORD=kong
-e KONG_PG_DATABASE=kong
-e KONG_PG_HOST=kong_db
-e KONG_PG_PORT=5432
-e KONG_ADMIN_LISTEN=0.0.0.0:8001
-e KONG_ADMIN_LISTEN_SSL=0.0.0.0:8444
-e KONG_PROXY_LISTEN=0.0.0.0:80
-e KONG_PROXY_LISTEN_SSL=0.0.0.0:443
-e KONG_PROXY_ACCESS_LOG=/dev/stdout
-e KONG_ADMIN_ACCESS_LOG=/dev/stdout
-e KONG_PROXY_ERROR_LOG=/dev/stderr
-e KONG_ADMIN_ERROR_LOG=/dev/stderr
kong:0.13.0-alpine
But, whenever I try to connect to either 443 or 8444, I get the error that the connection is refused.
vagrant@sms-02:~> curl -k https://127.0.0.1/
curl: (7) Failed to connect to 127.0.0.1 port 443: Connection refused
If I attach to the Kong container, it looks like nginx is not even configured to use SSL.
vagrant@sms-02:~> docker exec -it b191ea9e2c71 /bin/sh
/ # cat /usr/local/kong/nginx-kong.conf
charset UTF-8;
error_log syslog:server=kong-hf.mashape.com:61828 error;
error_log /dev/stderr notice;
client_max_body_size 0;
proxy_ssl_server_name on;
underscores_in_headers on;
lua_package_path ‘./?.lua;./?/init.lua;;;’;
lua_package_cpath ‘;;’;
lua_socket_pool_size 30;
lua_max_running_timers 4096;
lua_max_pending_timers 16384;
lua_shared_dict kong 5m;
lua_shared_dict kong_cache 128m;
lua_shared_dict kong_process_events 5m;
lua_shared_dict kong_cluster_events 5m;
lua_shared_dict kong_healthchecks 5m;
lua_socket_log_errors off;
init_by_lua_block {
kong = require ‘kong’
kong.init()
}
init_worker_by_lua_block {
kong.init_worker()
}
upstream kong_upstream {
server 0.0.0.1;
balancer_by_lua_block {
kong.balancer()
}
keepalive 60;
}
server {
server_name kong;
listen 0.0.0.0:80;
error_page 400 404 408 411 412 413 414 417 /kong_error_handler;
error_page 500 502 503 504 /kong_error_handler;
access_log /dev/stdout;
error_log /dev/stderr notice;
client_body_buffer_size 8k;
real_ip_header X-Real-IP;
real_ip_recursive off;
location / {
set $upstream_host '';
set $upstream_upgrade '';
set $upstream_connection '';
set $upstream_scheme '';
set $upstream_uri '';
set $upstream_x_forwarded_for '';
set $upstream_x_forwarded_proto '';
set $upstream_x_forwarded_host '';
set $upstream_x_forwarded_port '';
rewrite_by_lua_block {
kong.rewrite()
}
access_by_lua_block {
kong.access()
}
proxy_http_version 1.1;
proxy_set_header Host $upstream_host;
proxy_set_header Upgrade $upstream_upgrade;
proxy_set_header Connection $upstream_connection;
proxy_set_header X-Forwarded-For $upstream_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $upstream_x_forwarded_proto;
proxy_set_header X-Forwarded-Host $upstream_x_forwarded_host;
proxy_set_header X-Forwarded-Port $upstream_x_forwarded_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass_header Server;
proxy_pass_header Date;
proxy_ssl_name $upstream_host;
proxy_pass $upstream_scheme://kong_upstream$upstream_uri;
header_filter_by_lua_block {
kong.header_filter()
}
body_filter_by_lua_block {
kong.body_filter()
}
log_by_lua_block {
kong.log()
}
}
location = /kong_error_handler {
internal;
content_by_lua_block {
kong.handle_error()
}
}
}
server {
server_name kong_admin;
listen 0.0.0.0:8001;
access_log /dev/stdout;
error_log /dev/stderr notice;
client_max_body_size 10m;
client_body_buffer_size 10m;
location / {
default_type application/json;
content_by_lua_block {
kong.serve_admin_api()
}
}
location /nginx_status {
internal;
access_log off;
stub_status;
}
location /robots.txt {
return 200 'User-agent: *\nDisallow: /';
}
}
Thoughts on what I could be doing wrong?
Thanks,
Eric