1

I'm currently working on running our own Owncloud (version 9). I've done this several times with Apache but I'm having trouble configuring it with Nginx in the front as a Proxy.

Nginx config

server {
        listen 443 ssl http2;
        server_name example.com;

    index index.php index.html;

    ssl_certificate /path/ssl.crt;
    ssl_certificate_key /path/ssl.key;
    ssl_dhparam /path/dh.pem;
    ssl_buffer_size 8k;
    ssl_session_timeout 1d;
    ssl_session_cache builtin:1000 shared:SSL:50m;
    ssl_session_tickets off;
    ssl_trusted_certificate /path/ssl.crt;
    ssl_stapling on;
    ssl_stapling_verify on;
    resolver 8.8.8.8 8.8.4.4 valid=300s;
    resolver_timeout 10s;

    add_header Strict-Transport-Security "max-age=15768000; includeSubdomains; preload";

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
    ssl_prefer_server_ciphers on;

    location / {
            proxy_pass http://127.0.0.1:8080;
            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 X-Forwarded-Port 443;
            proxy_set_header Host $host;
        }
}

Apache Config

<VirtualHost *:8080>
    ServerAdmin email@example.com
    ServerName example.com
    DocumentRoot /var/www/owncloud

    <Directory /var/www/owncloud>
        Options +FollowSymLinks
        Options -Indexes
        AllowOverride All
        SetEnv HOME /var/www/owncloud
        SetEnv HTTP_HOME /var/www/owncloud
        SetEnv MOD_X_SENDFILE_ENABLED 1
    </Directory>
</VirtualHost>

Owncloud config - /var/www/owncloud/config/config.php

<?php
$CONFIG = array (
  'updatechecker' => false,
  'instanceid' => 'xxxxxxxx',
  'passwordsalt' => 'xxxxxxxx',
  'secret' => 'xxxxxxxx',
'overwritehost' => 'example.com:8080',
'overwriteprotocol' => 'https',
'overwritewebroot' => '/',
'proxy' => 'localhost',
'trusted_proxies' => array('192.168.0.2', '127.0.0.1'),
'forwarded_for_headers' => array('HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR'),
  'trusted_domains' => 
  array (
    0 => 'example.com',
  ),
  'datadirectory' => '/not/in/default/data',
  'overwrite.cli.url' => 'https://example.com',
  'dbtype' => 'mysql',
  'version' => '9.0.1.3',
  'dbname' => 'dbname',
  'dbhost' => 'dbhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_administrator',
  'dbpassword' => 'xxxxxx',
  'logtimezone' => 'UTC',
  'installed' => true,
);

I am able to access the site properly if I don't use Nginx. But if I do, the page will load with no styles. All of the request are getting 404 responses.

I think there is something wrong with my Nginx proxy config or my Owncloud config. I've read this https://doc.owncloud.org/server/8.0/admin_manual/configuration_server/config_sample_php_parameters.html but I don't know if I'm doing the Owncloud config right.

Thanks guys!

EDIT

Definitely not caused by APACHE CONFIG or OWNCLOUD CONFIG. There is an issue with JavaScript (.js) or CSS (.css) files not served properly - link.

jarvis
  • 2,006
  • 4
  • 18
  • 31
  • Why are you using Nginx and Apache - what do you hope to achieve by adding Nginx? Please post access and error logs for all products for one attempt to access the server, a curl or hit. If you're sure the request doesn't make it past Nginx obviously don't post those logs, but you could show requests either side as a sanity test. – Tim Apr 22 '16 at 05:07

0 Answers0