nothing to say.. @caizhiyuannn@gmail.com
配置/var/www/cgi-bin目录以及shell文件的权限,所有者为www-data。
shell文件必须有执行的权限
配置ScriptAlias / var/www/html 将脚本文件映射到主目录上 。
注意:ScriptAlias 所映射的目录后一定要加/
shell 等脚本文件输出时必须添加html 头文件
“Content-type: text/html” 用来指定网页的类型
shell 等脚本文件第一行必须声明执行脚本的语言。如shell为 : #!/bin/bash
#!/bin/bash
echo -e "Content-type: text-html \n\n"
echo "hello world"
date
<IfModule mod_alias.c>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
</IfModule>