树莓派配置apache+python
安装apache
apt-get install apache2
安装 apache mod_python模块
$ sudo apt-get update
$ sudo apt-get install libapache2-mod-python libapache2-mod-python-doc
apache的虚拟目录文件/etc/apache2/sites-enabled/000-default配置
Options Indexes FollowSymlinks
AllowOverride None
Order allow,deny
allow from all
SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On
配置好apache后重新启动服务 service apache2 restart
虚拟目录下创建inde.py测试文件并输入以下内容
def index(req):
return "We are in index()"
def hello(req):
return "We are in hello()"
访问http://127.0.0.1/index/index以及http://127.0.0.1/index/hello返回正确内容则表示配置成功