77556
                
              
                
              
                  
                  
              1
              
             
            
              反向代理前可以访问,代理后就不行了。
宝塔面板的nginx好像并没有这个 site-available目录,但是vhost目录是存放网站配置文件的,我将seafile.conf文件存放在了vhost目录,但我还不是很清楚 seafile.conf是不是可以放在vhost目录。
下面是我的配置文件,"xxx"代替域名或文件路径,我不知道设置得对不对
server {
listen 80;
server_name xxx;
proxy_set_header X-Forwarded-For $remote_addr;
location / {
     proxy_pass         http://127.0.0.1:8000;
     proxy_set_header   Host $http_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      /www/server/nginx/logs/seahub.access.log;
     error_log       /www/server/nginx/logs/seahub.access.log;
}
If you are using FastCGI,
which is not recommended, you should use the following config for location /.
location / {
fastcgi_pass    127.0.0.1:8000;
fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
fastcgi_param   PATH_INFO           $fastcgi_script_name;
fastcgi_param     SERVER_PROTOCOL     $server_protocol;
fastcgi_param   QUERY_STRING        $query_string;
fastcgi_param   REQUEST_METHOD      $request_method;
fastcgi_param   CONTENT_TYPE        $content_type;
fastcgi_param   CONTENT_LENGTH      $content_length;
fastcgi_param     SERVER_ADDR         $server_addr;
fastcgi_param     SERVER_PORT         $server_port;
fastcgi_param     SERVER_NAME         $server_name;
fastcgi_param   REMOTE_ADDR         $remote_addr;
fastcgi_read_timeout 36000;
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;
    send_timeout  36000s;
}
location /media {
    root /home/xxx/seafile-server-latest/seahub;
}
}
由于宽带没有公网,所以我用了frp内网穿透,并使用了http协议。
启动方式是 ```
./seafile.sh start ./seahub.sh start
均显示启动成功,却无法访问,宝塔端口检测8000端口未使用、而8082是正在使用的。
             
            
              
              
              
            
           
          
            
            
              给你个参考,
环境:宝塔免费版7.1.1,nginx 1.17.9,seafile pro 7.1.1 Beta,CentOS 7.7.1908 x64 (core),
nginx反代配置:
server
{
    listen 80;
	listen 443 ssl http2;
    server_name 1.test.cn;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/1.test.cn;
    
    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  /www/wwwlogs/1.test.cn.log;
           error_log  /www/wwwlogs/1.test.cn.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;
        
        send_timeout  36000s;
        proxy_request_buffering off;
    }
    location /media {
        root /root/seafile/seafile-server-latest/seahub;
    }
    
    
    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #HTTP_TO_HTTPS_START
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }
    #HTTP_TO_HTTPS_END
    ssl_certificate    /www/server/panel/vhost/cert/1.test.cn/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/1.test.cn/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    error_page 497  https://$host$request_uri;
    #SSL-END
    
    #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END
    
    #PHP-INFO-START  PHP引用配置,可以注释或修改
    include enable-php-00.conf;
    #PHP-INFO-END
    
    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/1.test.cn.conf;
    #REWRITE-END
    
    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    
    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }
   
}
             
            
              
              
              
            
           
          
            
              
                77556
                
              
              
                  
                  
              5
              
             
            
              哦,不好意思,之前因为时间紧,发帖的时候没想太多,而且很多试了方法都失败了。现在我补充一下:seafile版本:7.0.5 ;系统版本:ubuntu18.4;宝塔:7.1.1(免费版);Nginx版本 1.17.9。下次发帖时我会留心的。谢谢啦!
             
            
              
              
              
            
           
          
            
              
                Java
                
              
              
                  
                  
              7
              
             
            
              配置文件放在vhosts目录下,主配置文件里面要有:
include ./vhosts/*.conf;