求助nginx配置seahub但客户端访问报502错


#1

请教大家,我在CentOS7.6安装Seafile-Server-7.0.3,过程很顺利,服务器地址是:192.168.160.33,之后在Nginx1.12.2下配置Seahub,没有使用https,配置完成后,用./seafile.sh start和./seahub.sh start启动服务,但是在客户端电脑浏览器访问 192.168.160.33或192.168.160.33/seafhttp,都报错502 Bad Gateway
以下是我在服务器上的配置
1、 /etc/nginx/nginx.conf的内容
user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

Load dynamic modules. See /usr/share/nginx/README.dynamic.

include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;
}

http {
log_format main '$remote_addr - $remote_user [$time_local] “$request” ’
'$status $body_bytes_sent “$http_referer” ’
‘"$http_user_agent" “$http_x_forwarded_for”’;

access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

server {
listen 80;
server_name 192.168.160.33;

proxy_set_header X-Forwarded-For $remote_addr;

location / {
     proxy_pass         http://127.0.0.1:8000;
     proxy_set_header   Host $host;
     proxy_set_header   X-Real-IP $remote_addr;
     proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header   X-Forwarded-Host $server_name;
     proxy_read_timeout  1200s;

     # used for view/edit office file via Office Online Server
     client_max_body_size 0;

     access_log      /var/log/nginx/seahub.access.log;
     error_log       /var/log/nginx/seahub.error.log;
}

location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 break;
    proxy_pass http://127.0.0.1:8082;
    client_max_body_size 0;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
    proxy_request_buffering off;

    send_timeout  36000s;
}
location /media {
    root /home/user/haiwen/seafile-server-latest/seahub;
}
}

}

2、/root/haiwen/conf/ccnet.conf的内容
[General]
USER_NAME = bigshare
ID = f743aa0eeb6b1a1345d44ca52dee58ebb9f6c73f
NAME = bigshare
SERVICE_URL = http://192.168.160.33

[Client]
PORT = 13419

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = seadata2019
DB = ccnet-db
CONNECTION_CHARSET = utf8

3、/root/haiwen/conf/seahub_settings.py的内容

-- coding: utf-8 --

SECRET_KEY = “u@o3!s-eqanz%aak!85gdrks2p1uoh!)z)^5@thb7@1_en*gx1”

FILE_SERVER_ROOT = ‘http://192.168.160.33/seafhttp

DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘seahub-db’,
‘USER’: ‘seafile’,
‘PASSWORD’: ‘seadata2019’,
‘HOST’: ‘127.0.0.1’,
‘PORT’: ‘3306’
}
}
以上基本都是按照官方文档配置,感觉问题不大,但是浏览器访问报502,以下是服务器上的日志报错内容
1、/var/log/nginx/seahub.error.log部分内容
2019/07/24 15:47:57 [crit] 45583#0: *12 connect() to 127.0.0.1:8000 failed (13: Permission denied) while connecting to upstream, client: 192.168.3.21, server: 192.168.160.33, request: “GET /favicon.ico HTTP/1.1”, upstream: “…/favicon.ico”, host: “192.168.160.33”, referrer: “…/seafhttp/seafhttp”
2019/07/24 15:47:57 [crit] 45583#0: *12 connect() to 127.0.0.1:8000 failed (13: Permission denied) while connecting to upstream, client: 192.168.3.21, server: 192.168.160.33, request: “GET /favicon.ico HTTP/1.1”, upstream: “…/favicon.ico”, host: “192.168.160.33”, referrer: “…/seafhttp/seafhttp”
2019/07/24 15:47:58 [crit] 45583#0: *12 connect() to 127.0.0.1:8000 failed (13: Permission denied) while connecting to upstream, client: 192.168.3.21, server: 192.168.160.33, request: “GET /favicon.ico HTTP/1.1”, upstream: “…/favicon.ico”, host: “192.168.160.33”, referrer: “…/seafhttp/seafhttp”
注意到里面老是有Permission denied

2、/var/log/nginx/error.log
2019/07/24 15:47:57 [crit] 45583#0: *12 connect() to 127.0.0.1:8082 failed (13: Permission denied) while connecting to upstream, client: 192.168.3.21, server: 192.168.160.33, request: “GET /seafhttp/seafhttp HTTP/1.1”, upstream: “…/seafhttp”, host: “192.168.160.33”
2019/07/24 15:47:58 [crit] 45583#0: *12 connect() to 127.0.0.1:8082 failed (13: Permission denied) while connecting to upstream, client: 192.168.3.21, server: 192.168.160.33, request: “GET /seafhttp/seafhttp HTTP/1.1”, upstream: “…/seafhttp”, host: “192.168.160.33”

另外,目前在服务器上,通过浏览器是可以本地访问localhost:8000,显示出seahub服务器端的web页面,截图如下:

请大家帮忙看看 ,目前客户端浏览器访问报502错误,是什么原因,应该怎么解决,非常感谢!
如果需要确认其他配置信息就请告诉我,我再提供出来,麻烦大家啦 :grinning:


#2

我也遇到和你类似的情况,请问你的问题解决了吗?