Ubuntu 10.04 LTS + NginX + Django 1.3 (FastCGI) + Python 2.7.2
이번에는 Ubuntu 10.04 (LTS) 에서 NginX + Django 1.3 (FastCGI) + Python 2.7.2 를 구성해보았다. Python 을 설치하기 전에 zlibc 를 먼저 설치해주어야 distribute 가 제대로 설치되는 삽질이 있었긴 했지만, CentOS에서 설치했던 것처럼 대체적으로 무난하게 설정이 되었다.
- Install Python
# aptitude install zlibc zlib1g-dev # 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
- Install Django
# pip install django flup
- Create Project
# mkdir -p /opt/project # cd /opt/project # django-admin.py startproject sample_project # cd sample_project # mkdir media
- Run Project
# cd /opt/project/sample_project # python manage.py runfcgi method=threaded pidfile=/tmp/django_sample.pid host=127.0.0.1 port=8000
- Install NginX
# aptitude install nginx
- Configure NginX
# cd /etc/nginx/sites-available # vi django
server { listen 80; 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; } }
# cd /etc/nginx/sites-enabled # ln -s /etc/nginx/sites-available/django django
- Run NginX
# /etc/init.d/nginx restart
댓글
댓글 쓰기