skysparrow avatar

Apache2 서버에 CGI 셋팅

skysparrow

Published: 20 Jan 2018 › Updated: 20 Jan 2018Apache2 서버에 CGI 셋팅

Apache2 서버에 CGI 셋팅

mkdir /var/cgi-bin

and create a file called /var/cgi-bin/echo.pl with the following content:

#!/usr/bin/perl
use strict;
use warnings;
print qq(Content-type: text/plain );
print "hi ";

chomd +x /var/cgi-bin/echo.pl

/var/cgi-bin/echo.pl

Content-type: text/plain

hi

Apache /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

와 같은 형식에 내부에 아래 내용을 추가
ScriptAlias /cgi-bin/ /var/cgi-bin/
<Directory "/var/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted

CGI 모듈 활성화

ls -l /etc/apache2/mods-enabled/ | grep cgi

ls -l /etc/apache2/mods-available/ | grep cgi

-rw-r--r-- 1 root root 115 Jul 20 2013 cgid.conf
-rw-r--r-- 1 root root 60 Jul 20 2013 cgid.load
-rw-r--r-- 1 root root 58 Jul 20 2013 cgi.load
-rw-r--r-- 1 root root 89 Jul 20 2013 proxy_fcgi.load
-rw-r--r-- 1 root root 89 Jul 20 2013 proxy_scgi.load

CGI 모듈 링크

ln -s /etc/apache2/mods-available/cgid.load /etc/apache2/mods-enabled/

ln -s /etc/apache2/mods-available/cgid.conf /etc/apache2/mods-enabled/

ls -l /etc/apache2/mods-enabled/ | grep cgi

lrwxrwxrwx 1 root root 37 Mar 19 14:39 cgid.conf -> /etc/apache2/mods-available/cgid.conf
lrwxrwxrwx 1 root root 37 Mar 19 14:39 cgid.load -> /etc/apache2/mods-available/cgid.load

서비스 재 시작

service apache2 reload

Leave Apache2 서버에 CGI 셋팅 to:

Written by

Read more #apache posts


Best Posts From skysparrow

We have not curated any of skysparrow's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From skysparrow