抱歉,我的英语很差,我是法国人......没有人是完美的。
我试图在Nginx下安装ReviewBoard(LEMP与Debian Wheezy,Nginx 1.4.5,MySQL 14.14,PHP 5.4.4)。我的python安装使用Python 2.7.3,easy_install 0.6.24dev-r0,pip 1.1,virtualenv 1.11.4和gunicorn 18.0。
我成功安装了所有内容并创建了评论网站,但我无法通过浏览器访问评论网站。
我知道reviewboard推荐Apache,但也可以在Nginx上安装它。除了很多指向http:/ / rramsden.ca/blog/2011/09/26/nginx-reviewboard/的链接之外,我找不到任何分步教程,但这个链接已经死了。有谁知道另一个链接?
我的Nginx 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 / {
#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服务器,我使用:
root@jotunn:~# source /opt/reviewboard/rbenv/bin/activate
(rbenv)root@jotunn:~# rb-site manage /var/www/review.unskontrollables.org/ runserver
Validating models...
0 errors found
Django version 1.4.10, using settings 'reviewboard.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
如果我尝试访问
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之后,一切正常。