Thanks,
I did that and this it is working
/etc/apache2/conf-enabled/server-cgi-bin.conf
Code: Select all
<IfModule mod_alias.c>
<IfModule mod_cgi.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfModule mod_cgid.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfDefine ENABLE_USR_LIB_CGI_BIN>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
AddHandler cgi-script .py
</Directory>
</IfDefine>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
sudo adduser pi www-data
sudo chown pi:www-data -R /var/www
sudo chmod 0755 -R /var/www
sudo chmod g+s -R /var/www
chown -R www-data /var/www
chgrp -R www-data /var/www
chown -R www-data /usr/lib/cgi-bin
chgrp -R www-data /usr/lib/cgi-bin
/etc/apache2/conf-enabled/server-cgi-bin.conf
Then
a2enmod cgi
sudo systemctl restart apache2.service
sudo systemctl status apache2.service
If there is any errors, there is something wrong in the server-cgi-bin file.