Environment
1. ubuntu 14 server
2. apache2 install
I am not sure any python copy should be installed or not necessary.
First need to edit /etc/apache2/conf-enabled/serve-cgi-bin.conf
<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 None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Require all granted </Directory> </IfDefine> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
script files.
Note. this directory must fall in access range of apache2. You can edit apache2.conf under
/etc/apache2/ directory to add your directory
<Directory "/var/www/cgi-bin"> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory> <Directory "/var/www/cgi-bin"> Options All </Directory>
$ cd /etc/apache2/mods-enabled $ sudo ln -s ../mods-available/cgi.load
$ sudo service apache2 reload
oh! one more thing! Remember to change access mode to your script file.
sudo chmod +x /usr/lib/cgi-bin/xxx.py