Please take a look at this.
:: Build Nginx
Please take a look at this.
:: Build Python 2.6.2 from source
+ Download Python
linux:~ # mkdir download
linux:~ # cd download/
linux:~/download # wget http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tar.bz2
linux:~/download # tar -xjf Python-2.6.2.tar.bz2
+ Compiling Python
linux:~/download # cd Python-2.6.2/
linux:~/download/Python-2.6.2 # ./configure --enable-shared
linux:~/download/Python-2.6.2 # make && make install
+ Configuring library
linux:~/download/Python-2.6.2 # export LD_LIBRARY_PATH=/usr/local/libYou can add LD_LIBRARY_PATH permanently on bash.bashrc file.linux:~/download/Python-2.6.2 # vi /etc/bash.bashrc
--[ add this line on end of file ]--
export LD_LIBRARY_PATH=/usr/local/lib
-------------------------------------
linux:~/download/Python-2.6.2 # ln -s /usr/local/bin/python2.6 /usr/local/bin/python
+ Testing Python
linux:~/download/Python-2.6.2 # pythonCtrl+D for quit.
Python 2.6.2 (r262:71600, Aug 26 2009, 06:08:22)
[GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
:: Building Django
+ Download Django
linux:~ # cd download/
linux:~/download # wget http://www.djangoproject.com/download/1.1/tarball/
linux:~/download # tar -xzf Django-1.1.tar.gz
+ Compiling Django
linux:~/download # cd Django-1.1/
linux:~/download/Django-1.1 # python setup.py install
:: Configuring Nginx for Django
linux:~/download/Django-1.1 # vi /usr/local/nginx/conf/nginx.conf
--[ configure like this: ]--
worker_processes 2;
error_log /var/log/nginx/error_log info;
events {
worker_connections 1024;
use epoll;
}
http {
include /usr/local/nginx/conf/mime.types;
default_type application/octet-stream;
log_format main
'$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
client_header_timeout 10m;
client_body_timeout 10m;
send_timeout 10m;
connection_pool_size 256;
client_header_buffer_size 1k;
large_client_header_buffers 4 2k;
request_pool_size 4k;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
output_buffers 1 32k;
postpone_output 1460;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 75 20;
ignore_invalid_headers on;
index index.html;
server {
listen 80;
server_name localhost;
# site_media - folder in uri for static files
# you can change this wherever you want
location /site_media {
root /usr/local/nginx/examples;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov) {
access_log off; # po co mi logi obrazków :)
expires 30d;
}
location / {
# host and port to fastcgi server
fastcgi_pass 127.0.0.1:8080;
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;
}
access_log /var/log/nginx/localhost.access_log main;
error_log /var/log/nginx/localhost.error_log;
}
}
----------------------------------------------------------------------------
+ Make logs files
linux:~/download/Django-1.1 # mkdir /var/log/nginx/
linux:~/download/Django-1.1 # touch /var/log/nginx/error_log
linux:~/download/Django-1.1 # touch /var/log/nginx/localhost.error_log
linux:~/download/Django-1.1 # touch /var/log/nginx/localhost.access_log
+ Make working directory (examples)
i used examples directory from Django package.
linux:~/download/Django-1.1 # cp -r /root/download/Django-1.1/examples/ /usr/local/nginx/:: Running Djangon and Nginx
linux:~/download/Django-1.1 # cd /usr/local/nginx/examples/
linux:/usr/local/nginx/examples # python manage.py runfcgi host=127.0.0.1 port=8080 --settings=settings
linux:/usr/local/nginx/examples # /usr/local/nginx/sbin/nginx
:: Testing Django on Nginx
Open your web browser and goto url : http//youip/ or http://yourdomain.tld

:: Links
+ GoogleLinux
+ RkBlog
+ NginxWiki



0 komentar:
Post a Comment