kernelsauce / turbo

Turbo is a framework built for LuaJIT 2 to simplify the task of building fast and scalable network applications. It uses a event-driven, non-blocking, no thread design to deliver excellent performance and minimal footprint to high-load applications while also providing excellent support for embedded uses.
http://turbo.readthedocs.io/
Apache License 2.0
528 stars 84 forks source link

Question: How to bind to multiple ports/ips w/ and w/o SSL? #249

Closed Thomas12 closed 8 years ago

Thomas12 commented 8 years ago

Hi,

how can I bind one server to port 80 http and port 443 https at the same time? Is that possible? Tried with 2x listen, but SSL does not work then.

app:listen(80, "0.0.0.0", {max_body_size=1024_1024_100}) app:listen(443, "0.0.0.0", nil, { ssl_options = { key_file = "./sslkeys/server.key", cert_file = "./sslkeys/server.crt" } })

Thank you!

Thomas

kernelsauce commented 8 years ago

Hi. You have to use two HTTPServer instances that you feed your application object :).

`

http_server_80 = httpserver.HTTPServer(application)

http_server:listen(80)

http_server_443 = httpserver.HTTPServer(application)

http_server_443:listen(443)

ioloop_instance:start()

`

Thomas12 commented 8 years ago

Thank you, it works!