Apache2没有运行python脚本 [英] Apache2 not running a python script
问题描述
我是Web服务器的新手,我从头开始学习所有内容.
I am very new to webservers and I am learning everything from scratch.
我的网页很简单:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body style="background-color:black;color:white">
<p> My website test site</p>
<br>
<form action="hello.py">
First Name:
<input type="text" name="firstname">
<br>
Last Name:
<input type="text" name="firstname">
<input type="submit" name="submitbutton">
<br>
</form>
</body>
</html>
我的远程服务器正常工作,我进入了apache2.conf文件并尝试更改配置文件,以便apache2将运行python脚本:
My remote server works, I have gone into my apache2.conf file and tried to change the configuration file so that apache2 will run python scripts:
<Directory /var/www/html/>
AllowOverride None
Order allow,deny
Allow from all
Options +ExecCGI
AddHandler cgi-script .py
</Directory>
找到脚本,然后在浏览器中将脚本显示为文本文件,而不是运行脚本.我正在尝试从网页远程运行该程序.我现在知道输出将进入我的控制台.
The script is found and then instead of running the script, the script is displayed as a text file in the browser. I am trying to run this program remotely from a webpage. I understand right now the output will go to my console.
推荐答案
感谢,我添加了这些更改.另外,我需要重新启动服务器!
THanks, I added these changes. Plus I needed to restart the server!
这篇关于Apache2没有运行python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!