确保apache加载cgi模块
# mkdir /cgi 
#cd /cgi/
# vim index.cgi
# chmod +x index.cgi
# cat index.cgi
#!/bin/bash

echo "Content-type: text/plain"
echo ""
date
echo "login users:"
who
 
 
 
改配置文件
ScriptAlias /mycgi "/cgi"
测试:http://localhost/mycgi/index.cgi