我有一个本地虚拟主机站点,该站点具有一个需要通过CGI执行的python脚本,但到目前为止,它仍在加载代码。我做了$ sudo a2enmod cgi
,但还是没有运气。
apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built: Apr 3 2019 18:04:25
当我在浏览器或终端中尝试端点时,
curl http://local.mydomain.com/script.py
#!/usr/bin/env python
# chmod 755 script.py
print "Content-type: text/html\n\n"
...
这是我的/ etc / apache2 / sites-enabled / mydomain的样子:
<VirtualHost *:80>
ServerName local.mydomain.com
DocumentRoot /home/username/Dropbox/vhosts/mydomain/
<Directory /home/username/Dropbox/vhosts/mydomain>
Options +Indexes +FollowSymLinks +MultiViews +ExecCGI
AllowOverride All
Order allow,deny
allow from all
Require all granted
AddHandler cgi-script .py
</Directory>
ErrorLog /var/log/apache2/error.mydomain.log
LogLevel warn
CustomLog /var/log/apache2/access.mydomain.log combined
</VirtualHost>