Download Raspberry Pi

Transcript
Chapter 6
This tells Apache to take a Python script called addtemperature.wsgi, located in
the /var/www/wsgi-scripts/ directory you just created, and make it available via
the browser with the URL /addtemperature; for example, http://192.168.1.122/
addtemperature. After this, add the next block of configuration code below the
WGIScriptAlias:
<Directory /var/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
This defines a directory /var/www/wsgi-scripts and tells Apache to accept traffic
to it. This tag is responsible for defining configuration options for the directory listed
and subdirectories below it. Then save and exit your text editor and navigate back up
to the apache2 directory:
cd /etc/apache2
In this directory we need a file called httpd.conf. This file provides additional user
configuration for Apache. If this file does not exist, use your text editor to create it,
otherwise open the existing one.
We need to add a single line of configuration to this that tells Apache where it can
find the WSGI module that is needed to load our site configuration that we created
previously. If we do not add this to the httpd.conf file, then Apache will not know
what to do with the configuration we added to the default file and will throw an
error and not start.
So with the httpd.conf file open, if the file already existed, look for other references
to modules in the file these will take the following format:
LoadModule <module_name> modules/<module_reference>.so
If you created a new httpd.conf file, or no LoadModule references already exist,
then you can paste the following configuration into the empty file, otherwise add this
under the existing LoadModule references:
LoadModule wsgi_module modules/mod_wsgi.so
Save the file and exit your text editor. Now restart Apache using the restart command.
sudo apachectl restart
[ 99 ]