Apache2에서 cgi가 작동 할 때까지
환경
cgi 모듈 설치
cgid 설치
$ sudo apt install cgid
cgi 설정 확인
$ cd /etc/apache2/conf-available
$ ls
#serve-cgi-bin.confに設定が書いてある
harset.conf localized-error-pages.conf other-vhosts-access-log.conf security.conf serve-cgi-bin.conf
serve-cgi-bin.conf<IfModule mod_alias.c>
<IfModule mod_cgi.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfModule mod_cgid.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfDefine ENABLE_USR_LIB_CGI_BIN>
#URLで/cgi-bin/以下のファイルが/usr/lib/cgi-bin配下のファイルと結びつく
ScriptAlias /cgi-bin/ "/usr/lib/cgi-bin/"
<Directory "/usr/lib/cgi-bin">
AllowOverride None
#+ExecCGIがオプションとして書かれているのでCGIが動く
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
#.cgiの拡張子がつくファイルがcgiスクリプトが書かれているファイルであることを設定
AddHandler cgi-script .cgi
</Directory>
</IfDefine>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
cgi 파일 설치
$ cd /usr/lib/cgi-bin
$ vi hello.cgi
hello.cgi#!/bin/bash
echo "Content-Type: text/html;charset=utf-8\n"
echo ""
echo '<html><body>Hello cgi.</body></html>'
파일 권한으로 실행 권한 부여
$ sudo chmod 755 hello.cgi
확인
Reference
이 문제에 관하여(Apache2에서 cgi가 작동 할 때까지), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/ftakahiro190307/items/c58d157dd1e68b5da601
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
$ sudo apt install cgid
$ cd /etc/apache2/conf-available
$ ls
#serve-cgi-bin.confに設定が書いてある
harset.conf localized-error-pages.conf other-vhosts-access-log.conf security.conf serve-cgi-bin.conf
<IfModule mod_alias.c>
<IfModule mod_cgi.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfModule mod_cgid.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfDefine ENABLE_USR_LIB_CGI_BIN>
#URLで/cgi-bin/以下のファイルが/usr/lib/cgi-bin配下のファイルと結びつく
ScriptAlias /cgi-bin/ "/usr/lib/cgi-bin/"
<Directory "/usr/lib/cgi-bin">
AllowOverride None
#+ExecCGIがオプションとして書かれているのでCGIが動く
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
#.cgiの拡張子がつくファイルがcgiスクリプトが書かれているファイルであることを設定
AddHandler cgi-script .cgi
</Directory>
</IfDefine>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
$ cd /usr/lib/cgi-bin
$ vi hello.cgi
hello.cgi
#!/bin/bash
echo "Content-Type: text/html;charset=utf-8\n"
echo ""
echo '<html><body>Hello cgi.</body></html>'
파일 권한으로 실행 권한 부여
$ sudo chmod 755 hello.cgi
확인
Reference
이 문제에 관하여(Apache2에서 cgi가 작동 할 때까지), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/ftakahiro190307/items/c58d157dd1e68b5da601
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Reference
이 문제에 관하여(Apache2에서 cgi가 작동 할 때까지), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ftakahiro190307/items/c58d157dd1e68b5da601텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)