Skip to content

Python 으로 가장 많이 이용되는 웹프레임워크는 Django 이다. 최근 가벼움과 성능으로 인정을 받고 있는 NginX 와 FastCGI 로 연동하여 설치하는 방법을 간단하게 정리해보았다. CentOS 6.0 이 나오긴 했지만, 아직 5.x 환경도 많이 이용되고 있으리라 생각하여 CentOS 5.6 에서 테스트하였으며, 아마 6.0 에서도 무리없이 설치될 것으로 믿는다.

  1. Install Python
    # echo 'export PYTHONBREW_ROOT=/opt/pythonbrew' >> /etc/profile; source /etc/profile
    # curl -kLO http://xrl.us/pythonbrewinstall; chmod +x pythonbrewinstall; ./pythonbrewinstall
    # echo 'source /opt/pythonbrew/etc/bashrc' >> /etc/profile; source /etc/profile
    # pythonbrew install --force --no-test 2.7.2
    # pythonbrew switch 2.7.2
  2. Install Django
    # pip install django flup
  3. Create Project
    # mkdir -p /opt/project
    # cd /opt/project
    # django-admin.py startproject sample_project
    # cd sample_project
    # mkdir media
  4. Run Project
    # cd /opt/project/sample_project
    # python manage.py runfcgi method=prefork pidfile=/tmp/django_sample.pid host=127.0.0.1 port=8000
  5. Install NginX
    # yum install nginx
  6. Configure NginX
    # cd /etc/nginx
    # vi nginx.conf
    ...
        server {
            server_name 도메인주소;
            location /site_media  {
                root /opt/project/sample_project/media/;
            }
            location / {
                # host and port to fastcgi server
                fastcgi_pass 127.0.0.1:8000;
                fastcgi_param PATH_INFO $fastcgi_script_name;
                fastcgi_param REQUEST_METHOD $request_method;
                fastcgi_param QUERY_STRING $query_string;
                fastcgi_param CONTENT_TYPE $content_type;
                fastcgi_param CONTENT_LENGTH $content_length;
                fastcgi_pass_header Authorization;
                fastcgi_intercept_errors off;
            }
        }
    ...
  7. Run NginX
    # /etc/init.d/nginx restart
profile

일요일은 짜빠게뤼~ 먹는날~^^

엮인글 :
http://adminplay.com/278629/a2a/trackback
List of Articles
번호 제목 글쓴이 날짜sort 조회 수
27 외국 자료실 (Unix Linux Windows) ADMINPLAY 2009-02-04 18895
26 파일시스템 체크 ADMINPLAY 2009-01-22 20116
25 top 명령어 정리 ADMINPLAY 2009-01-10 18595
24 콘솔에서 로그인이 안될때 ADMINPLAY 2008-12-29 21260
23 OS 종류 및 버전확인 ADMINPLAY 2008-12-23 21701
22 마우스 오른쪽 버튼 막기... ADMINPLAY 2008-12-14 19065
21 /var 디렉토리 용량이 갑자기!!! ADMINPLAY 2008-12-14 20237
20 CentOS 5 32bit에서 메모리 4G 지원하기 ADMINPLAY 2008-12-10 20829
19 single mode readonly 파티션 rw로 다시 마운트 ADMINPLAY 2008-12-10 23302
18 실시간 접근정보 확인 ADMINPLAY 2008-12-10 22061
17 kernel panic 발생 시 자동으로 리부팅 설정 ADMIN 2008-12-10 24084
16 서버 점검 : 자원 및 apache, mysql ADMIN 2008-12-10 23466
15 리눅스에서 실수로 삭제한 파일을 복구 ADMIN 2008-12-10 23597
14 각종 데몬 이름 및 설명 ADMIN 2008-11-25 13782
13 리눅스 - 하드디스크 추가, 파티션 및 마운트 ADMIN 2008-11-12 18269
12 리눅스 전원부터 부팅이 되기까지의 과정이해 ADMIN 2008-11-11 58404
11 Maskrading ADMIN 2008-11-11 59570
10 강제로 언마운트 하기 ADMIN 2008-11-11 20500
9 부분적으로 yum 업데이트 하고 싶을때 ADMIN 2008-11-10 17074
8 리눅스에서 계정 생성시 자동으로 디렉토리가 생성되게 하... ADMIN 2008-11-04 21625

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234