Apache配置CGI

硬件:BeagleBone Black

系统:Ubuntu(16.04)

Apache版本:Apache/2.4.18 (Ubuntu)


<span style="font-size:18px;">ubuntu@arm: sudo vim /etc/apache2/conf-available/serve-cgi-bin.conf</span>

修改为下列内容

<span style="font-size:18px;">ScriptAlias /cgi-bin/ /var/www/cgi-bin/
		<Directory "/var/www/cgi-bin">
			AllowOverride None
			Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
			Require all granted
			AddHandler cgi-script .cgi .py .pl
		</Directory></span>

启动CGI模块

<span style="font-size:18px;">ubuntu@arm:/$ sudo a2enmod cgi
</span>

cgi程序

<span style="font-size:18px;">ubuntu@arm:/$ vim /var/www/cgi-bin/hello.py
</span>

#!/usr/bin/python
print "Content-type: text/html\n\n"
print "Hello Word Python!\n"


重启apache

<span style="font-size:18px;">ubuntu@arm:/$ sudo service apache2  restart
</span>


打开浏览器查看
<span style="font-size:18px;">http://<span style="font-family: "Microsoft YaHei"; line-height: 26px;">192.168.7.2</span>/cgi-bin/hello.py</span>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值