Web服务器CGI的配置
2016-12-09 20:00
120 查看
Web服务器CGI的配置
CGI程序运行在Web服务器端,Web服务器可以是Apache,Nginx等GGI程序可以是Python,Ruby,Perl,Shell,C/C++等
配置
apache默认加载cgi模块(若没加载,先加载):LoadModule cgi_module modules/mod_cgi.so
修改httpd.conf配置中的以下内容:
#1.在Options中添加ExecCGI的选项 <Directory "D:/wamp/www/"> ... Options Indexes FollowSymLinks ExecCGI ... </Directory> #2.在AddHandler中添加可执行的程序类型(.py) # AddHandler allows you to map certain file extensions to "handlers": # actions unrelated to filetype. These can be either built into the server # or added with the Action directive (see below) # # To use CGI scripts outside of ScriptAliased directories: # (You will also need to add "ExecCGI" to the "Options" directive.) # AddHandler cgi-script .cgi .py .pl 注意:以下的内容部分不需要修改 <Directory "D:/wamp/bin/apache/apache2.4.9/cgi-bin"> AllowOverride None Options None Require all granted </Directory>
编写CGI程序
Python CGI#!D:\Anaconda2\python.exe print "Content-type:text/html" print # 空行,告诉服务器头部结束 print '<html>' print '<head>' print '<meta charset="utf-8">' print '<title>Hello Word - 我的第一个 CGI 程序!</title>' print '</head>' print '<body>' print '<h2>Hello Word! 我是来自菜鸟教程的第一CGI程序</h2>' print '</body>' print '</html>' # ### 注意: # 1,第一行Python的执行路径一定要写对 # 2,第二行和第三行必不可少
参考
PythonCGI编程Wamp支持Python CGI
相关文章推荐
- 手把手教你在centos下编译安装配置高性能web服务器环境nginx+php(fast-cgi)+mysql等/适合小内存vps使用
- Apache Web 服务器配置CGI程序,执行Python、Perl脚本
- Win7的IIS配置asp.net出现“由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面。”(图文解决方法)
- Win7的IIS配置asp.net出现“由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面。”(图文解决方法)
- 手把手教你在centos下编译安装配置高性能web服务器环境nginx+php(fast-cgi)+mysql等/适合小内存vps使用
- 手把手教你在centos下编译安装配置高性能web服务器环境nginx+php(fast-cgi)+mysql
- (转载)Win7的IIS配置asp.net出现“由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面。
- 无法在Web服务器上启动调试,未将项目配置为进行调试.
- [转]Windows IIS WEB服务器配置安全规范
- [web服务器配置]Windows2000下Apache(阿帕奇)web服务器配置全攻略
- 手工更新 Domino Web 服务器配置文件
- 加固基于Windows 2003平台的WEB服务器配置
- Windows WEB服务器配置安全规范
- 优化 Web 服务器计算机和特定应用程序的配置文件以符合您的特定需要
- 在R5中如何将一个Domino Web服务器配置为多个Web站点--虚拟服务器
- 从多个配置服务器列表中尝试连接web服务
- 无法在Web服务器上启动调试,未将项目配置为进行调试.
- 配置适用于正式使用环境下的Tomcat Web服务器双向SSL认证
- 配置适用于正式使用环境下的Tomcat Web服务器双向SSL认证
- FreeBSD网站平台建设全过程(三、安装配置web服务器)