如何在Nginx下安装ReviewBoard?

2024-06-02 05:26:45 发布

您现在位置:Python中文网/ 问答频道 /正文

对不起,我英语不好,我是法国人。。。没有人是完美的。在

我试图在Nginx下安装ReviewBoard(LEMP with Debian Wheezy,nginx1.4.5,MySQL 14.14,php5.4.4)。我的python安装使用python2.7.3、easy_install 0.6.24dev-r0、pip1.1、virtualenv1.11.4和gunicorn 18.0。在

我成功地安装了所有这些东西,并创建了一个评论板网站,但我无法从浏览器访问审查板网站。在

我知道reviewboard推荐Apache,但也有可能在Nginx上安装它。除了许多指向http:/的链接,我找不到任何分步教程/rramsden.ca/blog/2011/09/26/nginx-reviewboard/但是这个链接是死的。有人知道另一个链接吗?在

我的Nginx配置是:

server {
    listen   80;
    server_name review.unskontrollables.org;
    root /var/www/review.unskontrollables.org/htdocs;

    # Error handlers
    error_page 500 502 503 504 /errordocs/500.html;

    # serve directly - analogous for static/staticfiles
    # Alias static media requests to filesystem
    location /media {
        alias /var/www/review.unskontrollables.org/htdocs/media;
        # if asset versioning is used
        if ($query_string) {
            expires max;
        }
    }
    location /static {
        alias /var/www/review.unskontrollables.org/htdocs/static;
    }
    location /errordocs {
        alias /var/www/review.unskontrollables.org/htdocs/errordocs;
    }
    location /favicon.ico {
        alias /var/www/review.unskontrollables.org/htdocs/static/rb/images/favicon.png;
    }
    #~ location /admin/media/ {
        #~ # this changes depending on your python version
        #~ root /usr/local/lib/python2.6/site-packages/django/contrib;
    #~ }

    location / {
        #alias /var/www/review.unskontrollables.org/htdocs/reviewboard.wsgi;
        #root /var/www/review.unskontrollables.org/htdocs/reviewboard.wsgi/;
        #proxy_pass_request_headers on;
        proxy_pass_header Server;
        proxy_set_header Host $proxy_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_connect_timeout 10;
        proxy_read_timeout 10;
        proxy_pass http://127.0.0.1:8000/;
    }

    # Prevent the server from processing or allowing the rendering of
    # certain file types.
    location /media/uploaded {
        types {
            text/plain .html .htm .shtml .php .php3 .php4 .php5 .phps .asp .pl .py .fcgi .cgi .phtml .phtm .pht .jsp .sh .rb;
        }
    }
}

要启动WSGI服务器,我使用:

^{pr2}$

如果我试图进入

http://review.unskontrollables.org/

我被重定向到

http://127.0.0.1:8000/r/

控制台输出为:

/opt/reviewboard/rbenv/local/lib/python2.7/site-packages/Django-1.4.10-py2.7.egg/django/views/generic/list_detail.py:10: DeprecationWarning: Function-based generic views have been deprecated; use class-based views instead.
  DeprecationWarning
/opt/reviewboard/rbenv/local/lib/python2.7/site-packages/Django-1.4.10-py2.7.egg/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
/opt/reviewboard/rbenv/local/lib/python2.7/site-packages/Django-1.4.10-py2.7.egg/django/views/generic/simple.py:8: DeprecationWarning: Function-based generic views have been deprecated; use class-based views instead.
  DeprecationWarning
[14/Mar/2014 16:59:50] "GET / HTTP/1.0" 302 0

有人有主意吗?在

谢谢。在

编辑:我根据下面的教程找到了一个解决方案 https://github.com/shuge/man/blob/master/sa/review/reviewboard/reviewboard-quick-install-guide.md 缺少到配置文件rb.m的链接。com.conf公司指向此文件:https://github.com/shuge/man/blob/master/sa/review/reviewboard/rb.m.com.conf

使用这些数据,我只添加了flup(fastcgi python模块)并将conf更改为以下内容:

server {
    listen   80;
    server_name review.unskontrollables.org;
    root /var/www/review.unskontrollables.org/htdocs;

    # Error handlers
    error_page 500 502 503 504 /errordocs/500.html;

    # serve directly - analogous for static/staticfiles
    # Alias static media requests to filesystem
    location /media {
        alias /var/www/review.unskontrollables.org/htdocs/media;
        # if asset versioning is used
        if ($query_string) {
            expires max;
        }
    }
    location /static {
        alias /var/www/review.unskontrollables.org/htdocs/static;
    }
    location /errordocs {
        alias /var/www/review.unskontrollables.org/htdocs/errordocs;
    }
    location /favicon.ico {
        alias /var/www/review.unskontrollables.org/htdocs/static/rb/images/favicon.png;
    }
    #~ location /admin/media/ {
        #~ # this changes depending on your python version
        #~ root /usr/local/lib/python2.6/site-packages/django/contrib;
    #~ }

    location / {
        fastcgi_pass 127.0.0.1:9090;      
        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; 
    }

    # Prevent the server from processing or allowing the rendering of
    # certain file types.
    location /media/uploaded {
        types {
            text/plain .html .htm .shtml .php .php3 .php4 .php5 .phps .asp .pl .py .fcgi .cgi .phtml .phtm .pht .jsp .sh .rb;
        }
    }
}

nginx重启后,一切正常。在


Tags: orgservervarwwwstaticaliaslocationfastcgi