http与cgi
2016-09-28 18:23
211 查看
首先我先给大家解释cgi是什么?cgi定义:cgi(Common Gateway Interface)是http服务器与你的机器或其它机器上的程序进行“交谈 ”的一种工具,其程序必须运行在网络服务器上。cgi处理程序的步骤:1:通过网络把用户请求发送到服务器2:服务器接受用户请求并交给cgi程序处理3:cgi程序把处理结果传回给服务器4:服务器把结果送回到用户注意:cgi程序不是放到服务器上就能顺利运行,需要对所使用的服务器进行配置。(下面是我对http服务器的一些配置)(1)yum install prel-CGI.noarch (下载第三方软件去支持cgi和http能够合作)(2)到http默认发布目录/var/www/html建立一个目录cgi(自己可以随便建立任意一个目录),在cgi目录下写index.cgi这个文件,文件内容如下(显示时间):#!/usr/bin/perlprint "Content-type: text/html\n\n";print `date`;(3)到/etc/httpd/conf.d下有一个default.conf(如果没有这个文件可自行建立)文件内容如下Virtualhost _default_:80> Documentroot "/var/www/html" customlog "logs/default-vhost.log" combinedWed Jun 17 18:24:24 CST 2015 require all granted Options +ExecCGI AddHandler cgi-script .cgi (4)给/var/www/html/cgi/index.cgi一个执行权限及改变它的安全上下文[root@client ~]# chmod +x /var/www/html/cgi/index.cgi[root@client ~]# ls -l /var/www/html/cgi/index.cgi-rwxr-xr-x. 1 root root 67 Jun 17 16:49 /var/www/html/cgi/index.cgi[root@client ~]# semanage fcontext -a -t httpd_sys_script_exec_t '/var/www/html/cgi'[root@client ~]# restorecon -RvvF /var/www/html/cgi/[root@client ~]# ll -Zd /var/www/html/cgi/drwxr-xr-x. root root system_u:object_r:httpd_sys_script_exec_t:s0 /var/www/html/cgi/(5)这样就可以在浏览器中看到结果Wed Jun 17 18:24:24 CST 2015 ~
相关文章推荐
- PHP 指定的 CGI 应用程序由于未返回完整的一组 HTTP 头而产生错误行为。
- 解决:HTTP 错误 404.2 - Not Found. 由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面
- HTTP 学习笔记(4)----CGI
- busybox_httpd, http, CGI
- The specified CGI application misbehaved by not returning a complete set of HTTP headers
- Python的http服务(SimpleHTTPServer,BaseHTTPServer,CGIHTTPServer)
- c语言解析http请求表单内容,基于C语言的CGI开发
- HTTP 错误 404.2 - Not Found 由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面 详细错误:HTTP 错误
- HTTP 错误 404.2 - Not Found。由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面
- 目前互联网上公布出来的正文提取算法,大家可以综合比较下,一起来测试下哪个更好用。 词网--北京词网科技有限公司 http://demo.cikuu.com/cgi-bin/cgi-contex 猎兔网页正文提取 http://www.lie
- busybox_httpd, http, CGI
- The only thing I can think of is to use something like "http://www.dyndns.org/cgi-bin/check_ip.cgi" others may have a be
- 新解win8.1系统IIS出现“HTTP 错误 500.0,C:\php\php-cgi.exe - FastCGI 进程意外退出”
- HTTP 错误 404.2 - Not Found 由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面
- The specified CGI application misbehaved by not returning a complete set of HTTP headers错误解决办法
- HTTP 错误 404.2 - Not Found 由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面
- C开发CGI以及sqlite数据库http://www.liniu.cn/post/c-cgi-sqlite.html
- http的CGI、HTTPS、压缩配置
- A secure connection is requiered(such as ssl). More information at http://service.mail.qq.com/cgi-bi
- 【转载】IIS出现“HTTP 错误 500.0,C:\php\php-cgi.exe - FastCGI 进程意外退出”解决方法