This article covers how to enable WSGI module support in VestaCP for our customers. WSGI is the Web Server Gateway Interface. It is a specification that describes how a web server communicates with web applications, and how web applications can be chained together to process one request. Also, it implements the web server side of the WSGI interface for running Python web applications.
To enable WSGI support on a Debian or Ubuntu on Vesta Control Panel:
1. Install wsgi apache module
$ apt-get install libapache2-mod-wsgi
$ a2enmod wsgi
2. Download wsgi template
$ cd /usr/local/vesta/data/templates/web
$ wget http://c.vestacp.com/0.9.8/ubuntu/wsgi/apache2.tar.gz
$ tar -xzvf apache2.tar.gz
$ rm -f apache2.tar.gz
3. Create new package or set wsgi as apache template in the existing package
4. Add new user and assing him package with wsgi template
5. Add new domain and check the result
Importance of WSGI ?
1. WSGI gives you flexibility. Application developers can swap out web stack components for others. For example, a developer can switch from Green Unicorn to uWSGI without modifying the application or framework that implements WSGI.
2. WSGI servers promote scaling. Serving thousands of requests for dynamic content at once is the domain of WSGI servers, not frameworks. WSGI servers handle processing requests from the web server and deciding how to communicate those requests to an application framework's process. The segregation of responsibilities is important for efficiently scaling web traffic.
Facts about WSGI:
1. what WSGI stands for (Web Server Gateway Inteface)
2. A WSGI container is a separate running process that runs on a different port than your web server
3. Your web server is configured to pass requests to the WSGI container which runs your web application, then pass the response (in the form of HTML) back to the requester.