ciao!
volevo far eseguire uno script python usando apache.
ho abilitato il modulo:
codice:
# a2enmod cgi
# service apache2 restart
poi ho modificato il mio file default-ssl.conf:
codice:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
......................
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
# PRESENTE DI DEFAULT
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
# AGGIUNTO IO
<Directory /var/www/html>
Options +ExecCGI
AddHandler cgi-script .py
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
e riavviato il server.
poi ho creato un file python:
codice:
#!/usr/bin/python3
import cgitb
cgitb.enable()
print("Content-Type: text/html;charset=utf-8")
print("Hello World!")
se provo ad andare su www.sito.it/test.py, il file non lo esegue ma me lo fa scaricare.
cosa sto sbagliando secondo voi??