Friday, January 17, 2014

Step by step Enabling CGI configuration in Tomcat 6

1)The CGI is a way for a web server to interact with external content-generating programs, which are often referred to as CGI(Common Gateway Interface) programs

2)CGI support can be added when you are using Tomcat as your HTTP server and require CGI support.

3)Tomcat CGI support is implemented using the servlet class org.apache.catalina.servlets.CGIServlet. This servlet is mapped to the URL pattern "/cgi-bin/*".

Note : By default CGI support is disabled in Tomcat.

How To Enabe CGI (Common Gateway Interface) :

1) Uncomment the CGIServlet from web.xml file under TOMCAT_HOME/CONF folder that's commented by default .

2) Uncomment mapping for the CGI Gateway servlet from web.xml file under TOMCAT_HOME/CONF folder that's commented by default .

3) Add the priviliged ="true" in context.xml file under TOMCAT_HOME/CONF folder.

Note : you may see the below eror if you not added priviliged ="true" in context.xml .

PM org.apache.catalina.startup.HostConfig checkResources
WARNING: Error during context [] restart
java.lang.SecurityException: Servlet of class org.apache.catalina.servlets.CGIServlet is privileged and cannot be loaded by this web application
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1146)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
)
4) Restart the Tomcat server to Pick up the new configuration

5) Create a cgi folder under your webapps/xxxx/WEB-INF and place your CGI scripts in cgi folder .

6) access the url http://webservicesm.blogpsot.in:8080/cgi-bin/test.pl

No comments:

Post a Comment