免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2290 | 回复: 4
打印 上一主题 下一主题

Django 部署在Nginx 上不运行, 请指教 .. [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-08-14 02:40 |只看该作者 |倒序浏览
文件路径在: /home/Public_Html/down

运行 ./manage.py runserver 这样的 http://127.0.0.1:8000 django工作,正常访问


启动nginx后访问却不行.. 应该是django没工作 .. 高手看看是不是哪配置错误了..


Nginx.conf

user  www www;
worker_processes  5;
pid /var/run/nginx.pid;
error_log  /var/log/httpd/error.log warn;
events {
        worker_connections  10240;
#use ;

}
http {
        include       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  3m;
        client_body_timeout    3m;
        send_timeout           3m;
        connection_pool_size        256;
        client_header_buffer_size    1k;
        large_client_header_buffers    4 2k;
        request_pool_size        4k;
        output_buffers   4 32k;
        postpone_output  1460;
        sendfile        on;
        tcp_nopush             on;
        keepalive_timeout      75 20;
        tcp_nodelay            on;
        client_max_body_size       10m;
        client_body_buffer_size    256k;
        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;
        client_body_temp_path      /var/log/nginx/client_body_temp;
        proxy_temp_path            /var/log/nginx/proxy_temp;
        fastcgi_temp_path          /var/log/nginx/fastcgi_temp;
        gzip on;
        gzip_min_length  1100;
        gzip_buffers     4 32k;
#gzip_types       text/plain text/html application/x-javascript text/xml text/css;

        ignore_invalid_headers    on;
        include    website.conf;
}



Website.conf

server {
        listen 80;
        server_name test.tmdxy.org;

#root /home/Public_Html/down;


        access_log    /var/log/httpd/access.log main;
        location / {
                # host and port to fastcgi server

                fastcgi_pass unix:/tmp/test_tmdxy.sock;
                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_param REMOTE_ADDR           $remote_addr;
                fastcgi_param SERVER_PROTOCOL       $server_protocol;
                fastcgi_param SERVER_PORT           $server_port;
                fastcgi_param SERVER_NAME           $server_name;
                fastcgi_intercept_errors off;
                }
        location ^~ /media/ {
                alias    /home/Public_Html/django/meida/;
                }
        location ~* ^.+\.(gif|png|jpg|jpeg|css|swf|htm|html|asp|php|jsp|js|doc|txt)$ {
                 root    /home/Public_Html/django/media/;
                 access_log   off;
                }
}



Start(脚本)

#!/bin/bash

# Replace these three settings.

PROJDIR="/home/Public_Html/down"
PIDFILE="$PROJDIR/mysite.pid"
SOCKET="$PROJDIR/mysite.sock"
cd $PROJDIR
if [ -f $PIDFILE ]; then
    kill `cat -- $PIDFILE`
        rm -f -- $PIDFILE
        fi
        exec /usr/bin/python manage.py runfcgi method=prefork socket=${SOCKET} pidfile=${PIDFILE} minspare=5 maxspare=10 maxchildren=40


运行的顺序是 : 先 Start脚本,然后再运行的nginx ..
在浏览器中访问 django没有工作 .. 请高手指教下 ..
配置我是参考的 http://wiki.freebsdchina.org/doc/n/nginx_django 这篇文件

论坛徽章:
0
2 [报告]
发表于 2009-08-14 09:14 |只看该作者
查看nginx 错误log

论坛徽章:
0
3 [报告]
发表于 2009-08-14 09:48 |只看该作者
Nginx在x64的Linux压根就起不来,Welcome页面都看不到,为了更好的fastchi,我换lighttpd了。哈哈。

论坛徽章:
0
4 [报告]
发表于 2009-08-14 11:30 |只看该作者
原帖由 prolj 于 2009-8-14 09:48 发表
Nginx在x64的Linux压根就起不来,Welcome页面都看不到,为了更好的fastchi,我换lighttpd了。哈哈。

为何不试试scgi?我写quixote测试都用scgi+lighttpd

论坛徽章:
0
5 [报告]
发表于 2009-08-16 17:55 |只看该作者
原帖由 smallfish_xy 于 2009-8-14 11:30 发表

为何不试试scgi?我写quixote测试都用scgi+lighttpd

教教俺咋配服务器?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP