(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 <pre> Thehostnameis: 'hostname' Thetimeis: 'date' </pre> EOF
3. Global configuration page access properties: Add ExecCGI
ExecCGI function: allows the mod_cgi module to execute CGI scripts
4. Test
Success ~~