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/6cd/trackback
List of Articles
번호 제목 글쓴이 날짜sort 조회 수
347 /var 디렉토리 용량이 갑자기!!! ADMINPLAY 2008-12-14 20237
346 마우스 오른쪽 버튼 막기... ADMINPLAY 2008-12-14 19065
345 OS 종류 및 버전확인 ADMINPLAY 2008-12-23 21701
344 콘솔에서 로그인이 안될때 ADMINPLAY 2008-12-29 21260
343 top 명령어 정리 ADMINPLAY 2009-01-10 18595
342 파일시스템 체크 ADMINPLAY 2009-01-22 20116
341 외국 자료실 (Unix Linux Windows) ADMINPLAY 2009-02-04 18895
340 netstat 의 Send-Q, Recv-Q의 의미 ADMINPLAY 2009-02-09 24976
339 특정 디랙토리 인증걸기 htpasswd, htaccess ADMINPLAY 2009-03-04 21993
338 리눅스 TIP ADMINPLAY 2009-03-09 25525
337 Cent5 ffmpeg 설치 ADMINPLAY 2009-03-17 17996
336 rm -rf / ==> 그 결과는...ㄷㄷ;; ADMINPLAY 2009-03-17 20105
335 dumpe2fs 파일 시스템의 슈퍼 블럭과 블럭 그룹 정보를 출력 ADMINPLAY 2009-03-17 20694
334 사이트 이전시 - rsync ADMINPLAY 2009-03-17 17393
333 .vimrc 설정 설정, 색상 (VI 설정 색상) ADMINPLAY 2009-03-21 26177
332 리눅스 페도라 인터넷잡는것좀 알켜주세요^^; [1] 시풍 2009-04-07 20670
331 time.bora.net 시간 동기화후 dovecot 데몬이 죽는 현상 해결 ADMINPLAY 2009-04-27 23894
330 관리, 개발자를 위한 vi 환경 설정 ( vim-enhanced) ADMINPLAY 2009-04-27 18964
329 ssh, ftp 접근 딜레이 현상 발생시 조치방법 ADMINPLAY 2009-04-27 20058
328 리눅스 java tocmat 설치 ADMINPLAY 2009-05-07 18944

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234