zoukankan      html  css  js  c++  java
  • Tomcat7开启CGI支持的方法

    tomcat默认没有开启cgi支持,因此有了tomat开启cgi的探索。因为原本对tomcat没多了解,所以中间或多或少走了点弯路。还好最终配置成功了,现在jy也用上这个方法了。
        该方法在apache-tomcat-7.0.35上通过(jy提供的)。

    二、配置方法
      * 修改conf/web.xml文件

      1. 去掉默认的cgi 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>    <!--  CGI存储位置 -->
    
            </init-param>
    
            <init-param>
              <param-name>executable</param-name>      <!-- 默认均认为是perl 脚本            -->
              <param-value></param-value>                          <!-- 当设置为空时,有x权限的cgi均可执行 -->
    
              <param-name>executable</param-name>      <!-- 默认均认为是perl 脚本            -->
    
              <param-value></param-value>                          <!-- 当设置为空时,有x权限的cgi均可执行 -->
    
            </init-param>                                                          <!-- 注意启动tomcat的有效用户要对该cgi有执行权限 -->
            <init-param>
              <param-name>passShellEnvironment</param-name>  <!--传递不在CGI标准定义但在shell环境中的导出变量 -->
              <param-value>true</param-value>
            </init-param>
            <load-on-startup>5</load-on-startup>
        </servlet>

        2.  去掉默认的cgi servlet mapping 注释
       

    <servlet-mapping>
            <servlet-name>cgi</servlet-name>
            <url-pattern>/cgi-bin/*</url-pattern>
        </servlet-mapping>
    * 修改conf/context.xml
          在Context标签中加入如下属性
          <Context privileged="true">...</Context>

        * 将cgi程序放在WEB-INF/cgi目录中,没有新建
          最好让cgi程序有可执行权限 chmod u+x
        * 重启tomcat7
        * 通过http://url/cgi-bin/cgi来访问cgi.

    OK

  • 相关阅读:
    282. Expression Add Operators
    281. Zigzag Iterator
    280. Wiggle Sort
    How Not to Crash #2: Mutation Exceptions 可变异常
    Moving Swiftly
    How to Use updateConstraints
    Don’t Put View Code Into Your View Controller别把View创建的代码放在VC中
    Where-To-Put-The-Auto-Layout-Code
    iOS five years[转]
    ResponderChain note
  • 原文地址:https://www.cnblogs.com/lixinhai/p/4894439.html
Copyright © 2011-2022 走看看