📄 cgi.xml.ko
字号:
<?xml version='1.0' encoding='EUC-KR' ?><!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd"><?xml-stylesheet type="text/xsl" href="../style/manual.ko.xsl"?><!-- English Revision: 106090:151405 (outdated) --><!-- Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.--><manualpage metafile="cgi.xml.meta"> <parentdocument href="./">How-To / Tutorials</parentdocument> <title>酒颇摹 捧配府倔: CGI甫 荤侩茄 悼利 其捞瘤 积己</title> <section id="intro"> <title>家俺</title> <related> <modulelist> <module>mod_alias</module> <module>mod_cgi</module> </modulelist> <directivelist> <directive module="mod_mime">AddHandler</directive> <directive module="core">Options</directive> <directive module="mod_alias">ScriptAlias</directive> </directivelist> </related> <p>CGI (Common Gateway Interface)绰 昆辑滚啊 焊烹 CGI 橇肺弊伐 趣篮 CGI 胶农赋飘扼绊 何福绰, (昆其捞瘤 郴侩阑 父靛绰) 寇何 橇肺弊伐苞 烹脚窍绰 规过阑 沥狼茄促. 昆荤捞飘俊辑 悼利牢 其捞瘤甫 父靛绰 啊厘 如窍绊 埃窜茄 规过捞促. 捞 巩辑绰 酒颇摹 昆辑滚俊 CGI甫 备己窍绰 规过阑 家俺窍绊, CGI 橇肺弊伐阑 累己秦夯促.</p> </section> <section id="configuring"> <title>CGI甫 倾侩窍档废 酒颇摹 汲沥窍扁</title> <p>CGI 橇肺弊伐捞 棵官肺 悼累窍妨搁 CGI 角青捞 啊瓷窍档废 酒颇摹甫 汲沥秦具 茄促. 汲沥窍绰 规过篮 咯矾啊瘤促.</p> <section id="scriptalias"> <title>ScriptAlias</title> <p><directive module="mod_alias">ScriptAlias</directive> 瘤矫绢甫 荤侩窍搁 酒颇摹绰 漂沥 叼泛配府甫 CGI 橇肺弊伐侩栏肺 敌促. 酒颇摹绰 捞 叼泛配府俊 乐绰 葛电 颇老捞 CGI 橇肺弊伐捞扼绊 啊沥窍咯 努扼捞攫飘啊 磊盔阑 夸没窍搁 磊盔阑 角青窍妨绊 矫档茄促.</p> <p><directive module="mod_alias">ScriptAlias</directive> 瘤矫绢绰 促澜苞 鞍捞 荤侩茄促.</p> <example> ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/ </example> <p>困 抗力绰 酒颇摹甫 扁夯 厘家俊 汲摹茄 版快 <code>httpd.conf</code> 汲沥颇老俊 乐绰 郴侩捞促. <directive module="mod_alias">ScriptAlias</directive> 瘤矫绢绰 <directive module="mod_alias">Alias</directive> 瘤矫绢客 鞍捞 URL 菊何盒阑 漂沥 叼泛配府肺 措览茄促. <directive>Alias</directive>客 <directive>ScriptAlias</directive>绰 焊烹 <directive module="core">DocumentRoot</directive> 叼泛配府 观俊 乐绰 叼泛配府俊 荤侩茄促. <directive>Alias</directive>客 <directive>ScriptAlias</directive>狼 瞒捞痢篮 <directive>ScriptAlias</directive>啊 眠啊肺 URL 菊何盒栏肺 矫累窍绰 葛电 颇老阑 CGI 橇肺弊伐栏肺 秒鞭窍绰 痢捞促. 弊贰辑 困狼 汲沥篮 酒颇摹俊霸 <code>/cgi-bin/</code>栏肺 矫累窍绰 磊盔阑 夸没窍搁 <code>/usr/local/apache2/cgi-bin/</code> 叼泛配府俊辑 茫酒辑 CGI 橇肺弊伐栏肺 贸府窍扼绊 舅赴促.</p> <p>抗甫 甸绢, URL <code>http://www.example.com/cgi-bin/test.pl</code>阑 夸没窍搁 酒颇摹绰 <code>/usr/local/apache2/cgi-bin/test.pl</code> 颇老阑 角青窍咯 搬苞甫 馆券茄促. 拱沸 颇老捞 粮犁窍绊 角青啊瓷窍哥 绢恫 规过栏肺电 免仿阑 秦具 茄促. 弊犯瘤 臼栏搁 酒颇摹绰 坷幅巩阑 焊辰促.</p> </section> <section id="nonscriptalias"> <title>ScriptAlias 叼泛配府 观俊 乐绰 CGI</title> <p>焊烹 焊救惑 捞蜡锭巩俊 CGI 橇肺弊伐篮 <directive module="mod_alias">ScriptAlias</directive>茄 叼泛配府俊 茄沥茄促. 弊贰辑 包府磊绰 穿啊 CGI 橇肺弊伐阑 荤侩且 荐 乐绰瘤 决拜洒 皑刀且 荐 乐促. 弊矾唱 利寸茄 焊救炼摹甫 秒沁促搁 酒公 叼泛配府俊辑唱 CGI 橇肺弊伐阑 角青窍瘤 臼阑 捞蜡啊 绝促. 抗甫 甸绢, <directive module="mod_userdir">UserDir</directive> 瘤矫绢甫 荤侩窍咯 荤侩磊啊 磊脚狼 权叼泛配府俊 昆其捞瘤甫 啊瘤绰 版快甫 啊沥窍磊. 荤侩磊啊 磊脚狼 CGI 橇肺弊伐阑 荤侩窍绊 酵篮单 <code>cgi-bin</code> 叼泛配府俊 立辟鼻茄捞 绝促搁, 促弗 镑俊辑扼档 CGI 橇肺弊伐阑 角青窍绊 酵阑 巴捞促.</p> <p>酒公 叼泛配府俊辑唱 CGI 角青阑 倾侩窍妨搁 滴 苞沥捞 鞘夸窍促. 刚历, <directive module="mod_mime">AddHandler</directive>唱 <directive module="core">SetHandler</directive> 瘤矫绢甫 荤侩窍咯 <code>cgi-script</code> 勤甸矾甫 累悼秦具 茄促. 滴锅掳肺, <directive module="core">Options</directive> 瘤矫绢俊 <code>ExecCGI</code>甫 瘤沥秦具 茄促.</p> </section> <section id="options"> <title>Options甫 荤侩窍咯 疙矫利栏肺 CGI 角青阑 倾侩窍扁</title> <p>辑滚狼 林汲沥颇老俊 流立 <directive module="core">Options</directive> 瘤矫绢甫 荤侩窍咯 漂沥 叼泛配府俊辑 CGI 角青阑 倾侩且 荐 乐促.</p> <example> <Directory /usr/local/apache2/htdocs/somedir><br /> <indent> Options +ExecCGI<br /> </indent> </Directory> </example> <p>困 瘤矫绢肺 酒颇摹绰 CGI 颇老狼 角青阑 倾侩茄促. 绢恫 颇老捞 CGI 颇老牢瘤档 辑滚俊霸 舅妨具 茄促. 促澜 <directive module="mod_mime">AddHandler</directive> 瘤矫绢绰 辑滚俊霸 犬厘磊啊 <code>cgi</code>唱 <code>pl</code>牢 颇老篮 葛滴 CGI 橇肺弊伐捞扼绊 舅赴促.</p> <example> AddHandler cgi-script .cgi .pl </example> </section> <section id="htaccess"> <title>.htaccess 颇老</title> <p><a href="htaccess.html"><code>.htaccess</code> 捧配府倔</a>篮 <code>httpd.conf</code>俊 立辟鼻茄捞 绝绰 版快俊 CGI 橇肺弊伐阑 荤侩且 荐 乐绰 规过阑 舅妨霖促.</p> </section> <section id="userdir"> <title>荤侩磊 叼泛配府</title> <p>酒贰 汲沥阑 荤侩窍搁 荤侩磊 叼泛配府俊辑 <code>.cgi</code>肺 场唱绰 颇老阑 CGI 橇肺弊伐栏肺 角青茄促.</p> <example> <Directory /home/*/public_html><br/> <indent> Options +ExecCGI<br/> AddHandler cgi-script .cgi<br/> </indent> </Directory> </example> <p>促澜阑 荤侩窍搁 荤侩磊 叼泛配府狼 <code>cgi-bin</code> 窍困叼泛配府俊 乐绰 葛电 颇老阑 CGI 橇肺弊伐栏肺 牢侥茄促.</p> <example> <Directory /home/*/public_html/cgi-bin><br/> <indent> Options ExecCGI<br/> SetHandler cgi-script<br/> </indent> </Directory> </example> </section> </section> <section id="writing"> <title>CGI 橇肺弊伐 累己窍扁</title> <p>``老馆利牢'' 橇肺弊贰怪苞 CGI 橇肺弊贰怪 荤捞俊绰 滴啊瘤 林等 瞒捞痢捞 乐促.</p> <p>霉锅掳 瞒捞绰 CGI 橇肺弊伐篮 促弗 免仿阑 窍扁傈俊 刚历 MIME-type 庆歹甫 免仿秦具 茄促绰 痢捞促. HTTP 庆歹绰 努扼捞攫飘俊霸 努扼捞攫飘啊 绢恫 郴侩阑 罐霸瞪瘤 固府 舅赴促. 焊烹 促澜苞 鞍促.</p> <example> Content-type: text/html </example> <p>滴锅掳 瞒捞绰 HTML 趣篮 宏扼快历啊 焊咯临 荐 乐绰 屈侥栏肺 免仿秦具 茄促绰 痢捞促. 措何盒狼 版快 HTML阑 免仿窍瘤父, 锭锭肺 gif 弊覆苞 鞍捞 HTML捞 酒囱 郴侩阑 免仿窍绰 CGI 橇肺弊伐阑 累己窍绰 版快档 乐促.</p> <p>滴啊瘤甫 力寇窍绊绰 CGI 橇肺弊伐 累己篮 捞固 父甸绢 焊疽阑 促弗 橇肺弊伐甸苞 概快 厚搅窍促.</p> <section id="firstcgi"> <title>贸澜栏肺 父电 CGI 橇肺弊伐</title> <p>促澜篮 宏扼快历俊 茄 临阑 嘛绰 CGI 橇肺弊伐 抗力促. 弊措肺 <code>first.pl</code>捞扼绰 颇老俊 历厘窍绊, <code>cgi-bin</code> 叼泛配府俊 汗荤茄促.</p> <example> #!/usr/bin/perl<br /> print "Content-type: text/html\n\n";<br /> print "Hello, World."; </example> <p>Perl俊 劳槛窍瘤 臼歹扼档 公郊 老捞 老绢唱绰瘤 舅 荐 乐促. 霉锅掳 临篮 酒颇摹(趣篮 荤侩窍绰 僵)俊霸 <code>/usr/bin/perl</code> 困摹俊 乐绰 牢磐橇府磐阑 荤侩窍咯 捞 橇肺弊伐 颇老阑 角青窍扼绊 舅赴促. 滴锅掳 临篮 规陛 富茄 content-type 急攫阑 免仿窍绊 carriage-return 临官厕阑 滴锅 免仿茄促. 弊矾搁 庆歹 第俊 HTTP 庆歹狼 场阑 舵窍绰 后临捞 积扁绊, 夯巩捞 矫累茄促. 技锅掳 临篮 "Hello, World." 巩磊凯阑 免仿茄促. 捞巴栏肺 场捞促.</p> <p>宏扼快历甫 角青窍绊 林家甫 涝仿茄促</p> <example> http://www.example.com/cgi-bin/first.pl </example> <p>颇老 厘家甫 涝仿窍搁, 宏扼快历芒俊 <code>Hello, World.</code> 茄 临捞 焊牢促. 蕊盒登瘤绰 臼瘤父, 茄锅 悼累窍绰 巴阑 焊疽栏聪 捞力 促弗 巴阑 矫档秦 杭 荐 乐促.</p> </section> </section> <section id="troubleshoot"> <title>弊矾唱 酒流 悼累窍瘤 臼酒夸!</title> <p>昆俊辑 CGI 橇肺弊伐俊 立辟且锭 宏扼快历俊 唱棵 荐 乐绰 郴侩篮 扁夯利栏肺 匙啊瘤促.</p> <dl> <dt>CGI 橇肺弊伐狼 免仿</dt> <dd>亮促! 葛电 巴捞 肋 悼累茄促绰 舵捞促. 免仿篮 沥犬窍瘤父 宏扼快历啊 棵官肺 贸府窍瘤 给茄促搁, CGI 橇肺弊伐俊辑 棵官弗 <code>Content-Type</code>阑 汲沥窍看绰瘤 犬牢茄促.</dd> <dt>CGI 橇肺弊伐 家胶内靛 趣篮 "POST Method Not Allowed" 巩备</dt> <dd>CGI 橇肺弊伐阑 角青窍档废 酒颇摹甫 利例洒 汲沥窍瘤 臼疽促绰 舵捞促. <a href="#configuring">酒颇摹 汲沥窍扁</a>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -