Python CGI

= Installing =

Installation: sudo apt-get install apache2 sudo apt-get install python3

Enable CGI processing in apache: sudo a2enmod cgi

Configure Apache2: sudo nano /etc/apache2/conf-enabled/host-cgi.conf

ScriptAlias /cgi-bin/ /home/test/scripts/techsupp_analyzer/

 AllowOverride None Allow from all Require all granted Options +ExecCGI AddHandler cgi-script .py 

= Test Script = sudo nano /home/test/scripts/techsupp_analyzer/cgi.py

Change Permissions: sudo chown -R test:www-data cgi-bin/ sudo chmod +x cgi-bin/cgi.bin

Testing: http://10.140.196.7/cgi-bin/cgi.py

= Get inputs from URL =

Create a test CGI script in cgi-bin dir: nano test.py

Make it executable: sudo chmod +x test.py

Testing: http://10.140.196.7/cgi-bin/test.py?first_name=My&last_name=Admin

= Get Inputs from Form =

File Structure: --|---index.py  | |---test.py

In the same dir as above test.py, create Form Page: nano index.py

Make it executable: sudo chmod +x index.py

Testing http://10.140.196.7/cgi-bin/index.py

= Javascripts =


 * References