Answer the question
In order to leave comments, you need to log in
How to deploy aiohttp chat (Nginx+Supervisord)?
Hey!
There is an Ubuntu 16.04.1 LTS server (GNU/Linux 4.4.0-53-generic x86_64)
I decided to deploy aiohttp following the documentation example. Only in a more simplified form.
My nginx config:
upstream aiohttp_chat {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name example.com;
error_log /var/log/nginx/error.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_pass http://aiohttp_chat;
proxy_read_timeout 200;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
[program:chat]
command=/home/ubuntu/www/venv/bin/python /home/ubuntu/www/aiohttp-chat/app.py
directory=/home/ubuntu/www/aiohttp-chat
user=nobody
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisor/chat.err.log
stdout_logfile=/var/log/supervisor/chat.out.log
router = app.router
router.add_route('GET', '/chat/{channel}/{token}/', handlers.websocket_handler)
loop = asyncio.get_event_loop()
app = loop.run_until_complete(get_app())
web.run_app(app)
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