I know that there are tons of discussions in several forums, but unfortunately none of the answers and suggestions worked for me. I want to execute a very Simple Python script and view the output in the browser. I followed the instructions according to http://raspberrywebserver.com/cgiscripting/writing-cgi-scripts-in-python.html.
My "hello.py" Python file is located in /usr/lib/cgi-bin. When running it as python hello.py
from the Terminal everything works fine. My Apache2 Webserver also seems to run perfectly as it shows:
"It works! This is the default web page for this server. The web server software is running but no content has been added, yet."
when typing the IP of the Raspberry Pi (xxx.xxx.x.xx) in the browser.
When I add the path to my Python file like 192.168.0.12/cgi-bin/hello.py it says 404 - Not Found.
My Apache config file looks like this:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AddHandler cgi-script .cgi .py
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Any ideas so far?
sudo service apache2 reload
after manipulating the Apache config file I get:[ok] Reloading web server config: apache2 not running.
– Axel.Foley