Web Fast-CGI 激活

  • 去掉以下行的注释
LoadModule cgid_module modules/mod_cgid.so
  • 增加别名
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
  • 设置访问限制
<Directory "/var/www/cgi-bin/">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
  • 增加处理脚本解释器
AddHandler cgi-script .cgi .py
  • 创建处理脚本,假设文件名为:hello
#!/usr/bin/env python

print('Content-type: text/html')
print('')
print('Hello, world!')
  • 测试输出

重启apache/httpd服务后,使用http://<apache_ip>/cgi-bin/hello即可。

results matching ""

    No results matching ""