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