linux Apache CGI 安装配置

2019-10-15 21:06:31丽君

例如如下的更改:


<Directory /home/httpd/html> ? <Directory /home/jon/html>
Options Indexes Includes ExecCGI FollowSymLink
AllowOverride None
order allow,deny
allow from all
</Directory>
<Directory /home/httpd/cgi-bin> ? <Directory /home/jon/cgi-bin>
AllowOverride None
Options ExecCGI
</Directory>

如上做相应的更改,注意 /home/jon/cgi-bin为你的cgi程序的目录。
接着,修改 /etc/httpd/conf/srm.conf文件。
将DocumentRoot /home/httpd/html 改为DocumentRoot /home/jon/html
最后,修改 /etc/httpd/conf/httpd.conf文件。
将ServerName 这一个参数后面的原来的内容替换为你的本机ip地址或主机名,同时去掉前面的注释符 “#”。这里的配置为:
ServerName jon (jon 为我的主机名)
从新启动httpd进程:
#/etc/rc.d/init.d/httpd restart

四. CGI 程序的编写

首先,所有输出从您的CGI程序之前,必须由一个MIME类型的标题
1. 首先要确定Content-type: text/html