Implement CGI on the httpd server in Apache

Source: Internet
Author: User
Tags access properties
(1) the CGI script can also create a webpage CGI: CommonGatewayInterface public Gateway Interface Protocol. on The httpd server, the CGI mechanism can be implemented through CGI: converting the script to a client browser can identify the webpage format, that is, Content-Type: text/html. the CGI performer must be root, so it is dangerous. 1. the dependent module mod_al

(1) CGI scripts can also be used to create web pages

 

CGI: Common Gateway Interface public Gateway Interface Protocol

On the httpd server, you can use CGI to create web pages.

CGI mechanism: convert scripts to client browsers to identify the webpage format, namely, Content-Type: text/html

The CGI executor must be root, which is dangerous.

1. dependent module mod_alias mode_cgi

 

  LoadModule alias_module modules/mod_alias.soLoadModule cgid_module modules/mod_cgid.soLoadModule cgi_module modules/mod_cgi.so

Need to be enabled (before Module # delete)

 

2. create a CGI script

Create a cgiscript script in the/usr/local/apache/cgi-bin/directory.

  # Vim/usr/local/apache/cgi-bin/cgiscript

  Script content #! /Bin/bash # cat <EOFContent-Type: text/html
The hostname is : `hostname`The time is : `date`
EOF

 

3. global configuration page access properties: add ExecCGI

ExecCGI function: allows the mod_cgi module to execute CGI scripts

 

4. test

 

Success ~~

 
Related Article

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.