April 2015
Beginner
258 pages
5h 30m
English
As mentioned earlier, running Flask applications by directly launching the script works for testing, but is extremely unsafe and slow. In order to use nginx as the server for Pi MusicBox, the following needs to be added to the server block of the nginx site's configuration file (/etc/nginx/sites-available/pisite):
location = /piMusic { rewrite ^ /piMusic/; }
location /piMusic { try_files $uri @piMusic; }
location @piMusic {
include uwsgi_params;
uwsgi_param SCRIPT_NAME /piMusic;
uwsgi_modifier1 30;
uwsgi_passunix:/tmp/uwsgi.sock;
}For consistency, the Pi MusicBox directory should be moved to /srv.
Next, uWSGI needs to be installed and configured. You can think of it as the glue that will connect your application to nginx. ...