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

37번째 줄: 37번째 줄:
Starting httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
</source>
</source>
==hello.py 테스트==
* 아래 내용 참고 하여 /var/www/html/hello.py 파일 생성
<source lang='dos'>
[root@jmnote ~]# cat /var/www/html/hello.py
print "Content-type: text/plan\n"
print "Hello, world!"
</source>
<source lang='dos'>
[root@jmnote ~]# curl http://localhost/hello.py
Hello, world!
</source>
==참고 자료==
==참고 자료==
*http://mydoc.digimoon.net/board/skin/ggambo7002_board/print.php?id=board&no=550
*http://mydoc.digimoon.net/board/skin/ggambo7002_board/print.php?id=board&no=550


[[분류: Python]]
[[분류: Python]]

2014년 7월 16일 (수) 14:48 판

아파치 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>

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, world!"
[root@jmnote ~]# curl http://localhost/hello.py
Hello, world!

5 참고 자료

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