Another app server how-to, this time for an Nginx-backed, REST App server, running flask-socketio for adding real-time as well as HTTP end-points. This is a useful feature, to be able to take advantage of all the socketio libs popping up for Javascript, Swift, C++ and Java, and therefore iOS and Android.
Here’s the steps to install and configure, Nginx, Python, Flask-SocketIO, and get a very basic REST API up and testable. This post will not cover hardening or securing a server, see the previous post and cherry-pick the security commands that apply for this setup as well. Also, this is Ubuntu 14.04 again, but should be adaptable.
sudo su # or prefix all with sudo # INSTALL NGINX LATEST STABLE RELEASE apt-get install python-software-properties software-properties-common add-apt-repository ppa:nginx/stable apt-get update apt-get install nginx nginx-doc cd /usr/local/src/ git clone https://github.com/perusio/nginx_ensite.git cd nginx_ensite make install # INSTALL MYSQL - THIS SETUP NEEDS THIS BUT SUBSTITUTE MONGO/REDIS/RABBITMQ/POSTGRESQL apt-get install mysql-server mysql-client # install DB, make sure to set and store mysql root password mysql_install_db # initial mysql setup mysql_secure_installation # secures mysql install; prompted for mysql root password # SETUP FLASH-SOCKETIO apt-get install python-dev python-pip ssl-cert openssl-blacklist pip install flask-socketio pip install eventlet # http://eventlet.net/ pip install virtualenv pip install gunicorn # TODO: finish