Hi,
I have set up a Nextcloud 15 in a small server in my local network(192.168.24.209
) with Apache2 at port :85
, and it is behind a nginx reverse proxy in :80
.
Once I access it by its IP address:85, it works normally.
But when i trying to access it from port 80 or HOSTNAME.local
, it shows a " Access through untrusted domain" message. I should modify trusted_domain
array manually to get access.
So if I set a port forwarding to this PC, it will not work until I add the IP address to trusted_domain
.
How could this situation changed? I dont want to add trusted domains one by one.
I would appreciate it very much if you could help me!
My nginx.conf is here:
server {
listen 80;
server_name debian-server.local;
location / {
root html;
index index.html index.htm;
}
location /nextcloud {
# rewrite ^/nextcloud(.*) $1 break;
proxy_pass_header Server;
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-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_pass_header Authorization;
rewrite ^/nextcloud(.*) $1 break;
proxy_pass http://127.0.0.1:85;
}
My apache site conf is here:
<VirtualHost *:85>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/nextcloud
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /nextcloud "/var/www/nextcloud/"
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
</Directory>
</VirtualHost>
And, the nextcloud config.php:
<?php
$CONFIG = array (
'instanceid' => 'removed',
'passwordsalt' => 'removed',
'secret' => 'removed',
'trusted_domains' =>
array (
0 => '192.168.24.209:85',
1 => '192.168.24.209',
2 => '192.168.24.123' // my pc's address
),
'trusted_proxies' =>
array (
0 => '127.0.0.1:80'
),
'datadirectory' => '/var/www/files',
'dbtype' => 'mysql',
'version' => '15.0.4.0',
'overwrite.cli.url' => 'http://192.168.24.209:85/nextcloud',
'overwritewebroot' => '/nextcloud',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'removed',
'dbuser' => 'removed',
'dbpassword' => 'removed',
'installed' => true,
);
Information of my Server(probably):
Hostname: debian-server.local
Nextcloud Version: 15.0.4
OS: Debian 9.7 stretch amd64
Apache version: Apache/2.4.25(debian)
Nginx version: 1.15.8