Answer the question
In order to leave comments, you need to log in
Why doesn't unix socket (nginx + tornado) work?
I'm using ubuntu server 18.04, nginx and tornado
To launch a tornado I use the following code:
class Main:
PORT_MASK = '111{}'
PATH_MASK = '/tmp/111_{}'
SETTINGS = {}
ROUTE = []
def __init__(self, use_unix_socket=False):
server = tornado.httpserver.HTTPServer(tornado.web.Application(self.ROUTE, **self.SETTINGS))
if use_unix_socket:
server.add_socket(tornado.netutil.bind_unix_socket(self.PATH_MASK.format(0)))
else:
server.add_sockets(tornado.netutil.bind_sockets(int(self.PORT_MASK.format(0))))
tornado.process.fork_processes(0)
tornado.ioloop.IOLoop.current().start()
upstream 111 {
server localhost:1110 fail_timeout=0;
server unix:/tmp/111_0 fail_timeout=0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question