Tomcat7 how to turn on CGI support

Source: Internet
Author: User

Tomcat does not turn on CGI support by default, so there is an exploration of tomat to open CGI. Because the original to Tomcat did not know much, so the middle more or less go a little detour. Fortunately the final configuration succeeded, now JY also use this method.
The method is passed on the apache-tomcat-7.0.35 (JY provides).

Second, the configuration method
* Modify Conf/web.xml File

1. Remove the default CGI servlet annotations

<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 storage location -        </Init-param>        <Init-param>          <Param-name>Executable</Param-name>      <!--Perl scripts are considered by default -          <Param-value></Param-value>                          <!--CGI with x permission can be executed when set to null -          <Param-name>Executable</Param-name>      <!--Perl scripts are considered by default -          <Param-value></Param-value>                          <!--CGI with x permission can be executed when set to null -        </Init-param>                                                          <!--Note A valid user who starts Tomcat will have EXECUTE permission on the CGI -        <Init-param>          <Param-name>Passshellenvironment</Param-name>  <!--passing export variables that are not defined in the CGI standard but in the shell environment -          <Param-value>True</Param-value>        </Init-param>        <Load-on-startup>5</Load-on-startup>    </servlet>

2. Remove the default CGI servlet mapping annotations

< servlet-mapping >        < Servlet-name >cgi</servlet-name>        <Url-pattern >/cgi-bin/*</url-pattern>    </  Servlet-mapping>

* Modify Conf/context.xml      add      The following attribute to the Context tab <privileged= "true"  >... </ Context >

* The CGI program is placed in the web-inf/cgi directory with no new
It is best to have the CGI program executable permissions chmod u+x
* Restart TOMCAT7
* Access to CGI via http://url/cgi-bin/cgi.

Ok

Tomcat7 how to turn on CGI support

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.