I created a droplet on DigitalOcean but can not run the python scripts in cgi-bin folder. I tried
sudo a2enmod cgi
chmod a+rwx cgi-bin
Also give chmod 755 to files but It did not work. When I try to acces cgi-bin folder it gives Forbidden error and says You don't have permission to access /cgi-bin/ on this server.
Can any one help?
My config file
<VirtualHost *:80>
ScriptAlias /cgi-bin/ "/var/www/test/cgi-bin/"
<Directory /var/www/test/cgi-bin/>
AllowOverride All
Options ExecCGI
AddHandler cgi-script .cgi .pl .tcl .py
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/test/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks ExecCGI
Require all granted
</Directory>
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/test"
</VirtualHost>
Also I created a test python file in document root and when I opened it, it behaves like a text file.
You can try adding the following lines to your httpd.conf
or you web-server config file
<Files ~ "\.(py|cgi)$">
SetHandler python-script
Options +ExecCGI
</Files>
See Also : mod-python
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.