0

So I'm running a nextcloud server behind a proxy in the same network. So the proxy server handles the SSL and the app server the nextcloud instance. I'm having issues with timeouts and failures of both uploads and downloads. I think I might have issues with some configuration being on the wrong server since I just recently made the switch to this kind of setup instead of having clients connect to the app server directly. Both servers are running Ubuntu 14.04 and Nginx.

These are the different configurations.

App server:

server {
    listen 80 default_server;
    root /srv/nextcloud;
    index index.php index.html index.htm

    client_max_body_size 10G;
    fastcgi_buffers 64 4K;

    rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
        rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
        rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;

    error_page 403 /core/templates/403.php;
        error_page 404 /core/templates/404.php;

    location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
                deny all;
        }

        location / {
                # The following 2 rules are only needed with webfinger
                rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
                rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;

                rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
                rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;

                rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;

                try_files $uri $uri/ index.php;
        }

        location ~ \.php(?:$|/) {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include /etc/nginx/global.d/php5-params.conf;
        }

        # Optional: set long EXPIRES header on static assets
        location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
                expires 30d;
                # Optional: Don't log access to assets
                access_log off;
        }
}

Proxy server:

server {
        listen 80;
        root /srv/example.com;
        server_name example.com;

        location ~ /.well-known {
                allow all;
                try_files $uri =403;
        }

        # Force HTTPS
        location / {
                return 301 https://$host$request_uri;
        }
}

upstream cloud {
    server 192.168.77.3:80;
}

server {
    server_name example.com;
    client_max_body_size 10G;
    server_tokens off;
    listen 443 ssl http2;
    root /srv/example.com;

    # Load HTTPS config
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;  
    include /etc/nginx/global.d/https-common.conf;

    # nextcloud proxy
    location / {
        proxy_redirect off;
        proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   Host              $http_host;
        proxy_set_header   X-NginX-Proxy     true;
        proxy_set_header   Connection        "";
        proxy_http_version 1.1;
        proxy_pass http://cloud;
    }
}

And finally, this is my https configuration on the proxy server which is included from a separate file (https-common.conf):

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_session_timeout 1d;
#ssl_session_cache shared:SSL:50m;
ssl_stapling on;
ssl_stapling_verify on;
add_header Strict-Transport-Security "max-age=15768000; includeSubdomains";

So I guess that my question is if any of you have experience working with a nextcloud/owncloud setup behind a proxy or have a lot of experience with SSL issues and can see some apparent flaws in this configuration? Thanks! All ideas appreciated!

Niklas
  • 113
  • 2
  • 8

0 Answers0