CGI 사용하기
apache 의 설정 화일인 httpd.conf 화일을 수정한다.
CGI를 사용할 디렉토리 : /home/USER/public_html/cgi-bin
ScriptAlias 를 설정합니다.
ServerName www.formail.com
ServerAdmin USER@formail.org.com
ScriptAlias /cgi-bin/ /home/USER/public_html/cgi-bin/
|
html 문서 디렉토리 설정
아파치 설정 화일들 '/etc/httpd/conf/httpd.conf' , 'access.conf', 'srm,conf' 입니다.
하지만, httpd.conf에서 대부분의 설정이 가능하다.
UserDir public_html <-- 보통 이렇게 되어 있을 겁니다. |
그리고계정을 추가 하시면
예를들어 abc라는 계정을 추가 했다면
http://도메인/~abc 이렇게 됩니다.
Url 설정
http://도메인/~abc --> http://도메인/abc
srm.conf 화일을 수정을 한다. 다음을 추가한다.
Alias /abc /home/abc/public_html |
아파치를 다시 실행 시킨다.
httpd restart or apachectl restart |
httpd.conf 예제
# 아파치 서버를 설치하고 나서, localhost 를 하면 디폴트로 나오는 문서가 있는 디렉토리입니다.
DocumentRoot "/home/httpd/kedu" # 손대지 말고 디폴로 그냥 나둡니다.
#펄을 사용할때 CGI를 사용할때는 다음과 같이 설정을 해주어야 합니다.
<Directory />
Options FollowSymLinks ExecCGI
AllowOverride None
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/usr/local/httpd/htdocs"> # 손대지 말고 디폴로 그냥 나둡니다.
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
#이것은 다음과 같이 설정을 해줍니다.
Options Indexes FollowSymLinks Includes ExecCGI
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None # 통과
#
# Controls who can get stuff from this server.
#
Order allow,deny # 역시 통과
Allow from all # 손대지 말것
</Directory> # 손대지 말고 통과
# 사용자 계정을 만들고 나서 유저의 index.htm 이 실행되는 디렉토리
UserDir public_html
#브라우저를 실행 할때 기본적으로 읽어 들이는 화일을 설정하는 곳입니다.
DirectoryIndex index.htm index.html index.cgi index.php index.php3
# 펄을 사용할때 CGI 를 사용할때 다음과 같이 설정을 합니다.
AccessFileName .htaccess
<Files .htaccess>
Order allow,deny
Deny from all
</Files>
#php 를 사용할때는 다음과 같이 설정을 해줍니다.
AddType application/x-httpd-php .php3
AddType application/x-httpd-php-source .phps
AddType application/x-tar .tgz
#펄 CGI를 사용할때는 다음과 같이 설정을 해줍니다.
AddHandler cgi-script .cgi
|