Tomcat7 部署CGI程序
来源:互联网 发布:sql distinct 所有字段 编辑:程序博客网 时间:2024/06/05 05:44
部署环境:
1. ubuntu14.04.3_x64
2. jdk1.7.0_79
3. apache-tomcat-7.0.63
Apache官方参考资料: CGI How To
1) 修改$CATALINA_HOME/conf/web.xml
<!-- The CGI Gateway servlet --><servlet> <servlet-name>cgi</servlet-name> <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>cgiPathPrefix</param-name> <param-value>WEB-INF/cgi</param-value> </init-param> <load-on-startup>5</load-on-startup></servlet><!-- The mapping for the CGI Gateway servlet --><servlet-mapping> <servlet-name>cgi</servlet-name> <url-pattern>/cgi-bin/*</url-pattern></servlet-mapping>
根据web.xml
中的描述,关于executable
部分,默认值如下
<!-- if you leave the param blank it will run any script type. --><init-param> <param-name>executable</param-name> <param-value></param-value></init-param>
2) 修改$CATALINA_HOME/conf/context.xml
<Context privileged="true">...</Context>
在原来的基础上将Context部分添加上privileged="true"
3) 目录结构
|-tomcat|--webapps|---cgi-example|----WEB-INF|-----cgi|------first.py|------second.pl
4) 启动Tomcat
user@ubuntu:/opt/tomcat7/bin $./startup.sh
5) 访问路径
http://localhost:8080/cgi-example/cgi-bin/first.py
http://localhost:8080/cgi-example/cgi-bin/second.pl
附录
python first.py
#! /usr/bin/pythonprint "content-type: text/html"print ""print "<html><head><title>Welcome</title></head>"print "<body><h1>Welcome to the output of a CGI under Tomcat</h1>"print "<p>The subject says all.</p>"print "</body></html>"
Perl second.pl
#! /usr/bin/perl print "content-type: text/html"; $now = localtime(); print "<h1>It is $now</h1>";
0 0
- Tomcat7 部署CGI程序
- tomcat7与CGI
- tomcat7下CGi的配置
- maven下配置程序自动部署到tomcat7
- cgi程序
- maven部署应用tomcat7
- solr4.10.3部署tomcat7
- Maven Tomcat7自动部署
- Maven Tomcat7自动部署
- tomcat7.0的部署
- RHEL7安装部署Tomcat7
- tomcat7动态部署项目
- ubuntu 1404部署tomcat7
- maven自动部署tomcat7
- Linux下Tomcat7部署
- maven tomcat7 自动部署
- idea14 tomcat7 热部署
- Tomcat7部署java应用
- python操作cfg配置文件
- linux开放mysql 3306端口允许…
- iOS开发之如何跳到系统设置里的各种设置界面
- 【bzoj1570】[JSOI2008]Blue Mary的旅行 最大流
- Java基础(二):Object、Class、克隆、异常编程
- Tomcat7 部署CGI程序
- 简单文件下载,servlet+jsp
- Java设计模式——桥接模式
- 个人业务
- windows下配置CLion IDE
- Java中repalceAll和split的转义问题
- jQuery的选择器中的通配符[id^='code']
- jQuery的三种$()
- Relativelayout属性