Hello all,
I am running the docker image with nextcloud on a Debian server. There is placed an Nginx proxy before the nextcloud server. It works fine, except the rewrite for the REMOTE_ADDR. I have tried different configuration but I am unable to get it work.
My current configuration for the Nginx version is like following:
server {
server_name example.cloud www.example.cloud;
location / {
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 64;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Front-End-Https on;
proxy_pass http://192.168.1.20;
}
client_max_body_size 0;
underscores_in_headers on;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.cloud/fullchain.pem; # mana$
ssl_certificate_key /etc/letsencrypt/live/example.cloudprivkey.pem; # ma$
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.example.cloud) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = example.cloud {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name example.cloud.cloud www.example.cloud;
return 404; # managed by Certbot
}
And my current configuration of config.php for nextcloud is like following:
$CONFIG = array (
‘htaccess.RewriteBase’ => ‘/’,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘apps_paths’ =>
array (
0 =>
array (
‘path’ => ‘/var/www/html/apps’,
‘url’ => ‘/apps’,
‘writable’ => false,
),
1 =>
array (
‘path’ => ‘/var/www/html/custom_apps’,
‘url’ => ‘/custom_apps’,
‘writable’ => true,
),
),
‘instanceid’ => ‘’,
‘passwordsalt’ => ‘’,
‘secret’ => ‘’,
‘trusted_domains’ =>
array (
0 => ‘192.168.1.10’,
1 => ‘example.cloud’,
2 => ‘www.example.cloud’,
),
‘datadirectory’ => ‘/var/www/html/data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘15.0.5.3’,
‘overwrite.cli.url’ => 'http://192.168.1.20,
‘dbname’ => ‘’,
‘dbhost’ => ‘’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘mysql.utf8mb4’ => true,
‘dbuser’ => ‘’,
‘dbpassword’ => ‘’,
‘installed’ => true,
‘ldapIgnoreNamingRules’ => false,
‘ldapProviderFactory’ => ‘OCA\User_LDAP\LDAPProviderFactory’,
‘trusted_proxies’ => [‘192.168.1.20’],
‘overwriteprotocol’ => ‘http’,
);
Based on this documation --> https://docs.nextcloud.com/server/12/admin_manual/configuration_server/reverse_proxy_configuration.html I understand that I juste have to add my proxy to the trusted proxy list. I also tried to hardcode the forwarded_for_headers. But that also didn’t seem to help anything.
This are the version numbers for my environment.
Nextcloud version: 15.0.5.3 (Docker image)
Operating system and version: Debian 9.8
nginx version: 1.10.3
I hope that somebody can help me!
Thanks in advance.