"아파치 mod python 연동"의 두 판 사이의 차이

30번째 줄: 30번째 줄:
</Directory>
</Directory>
</source>
</source>
:→ [[.psp]] 파일은 mod_python.psp 핸들러가 처리
:→ [[.py]] 파일은 mod_python.cgihandler 핸들러가 처리


==아파치 재시작==
==아파치 재시작==

2014년 7월 16일 (수) 15:00 판

아파치 mod_python 연동

1 mod_python 설치

2 httpd.conf 파일 수정

vi /etc/httpd/conf/httpd.conf
변경 전
<Directory "/var/www/html">
	Options Indexes FollowSymLinks
	AllowOverride None
	Order allow,deny
	Allow from all
</Directory>
변경 후
<Directory "/var/www/html">
	Options Indexes FollowSymLinks
	AllowOverride None
	Order allow,deny
	Allow from all
	AddHandler mod_python .psp .psp_ .py
	PythonHandler mod_python.psp | .psp .psp_
	PythonHandler mod_python.cgihandler | .py
	PythonDebug On
</Directory>
.psp 파일은 mod_python.psp 핸들러가 처리
.py 파일은 mod_python.cgihandler 핸들러가 처리

3 아파치 재시작

[root@jmnote ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

4 hello.py 테스트

  • 아래 내용 참고하여 /var/www/html/hello.py 파일 생성
[root@jmnote ~]# cat /var/www/html/hello.py
print "Content-type: text/plan\n"
print "Hello, Python!"
[root@jmnote ~]# curl http://localhost/hello.py
Hello, Python!

5 hello.psp 테스트

  • 아래 내용 참고하여 /var/www/html/hello.psp 파일 생성
[root@jmnote ~]# cat /var/www/html/hello.psp
<html>
<body>
<h2><%= 'Hello, PSP!' %></h2>
</body>
</html>
[root@jmnote ~]# curl http://localhost/hello.psp
<html>
<body>
<h2>Hello, PSP!</h2>
</body>
</html>

6 같이 보기

7 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}