0

setting up my Dockered Applications (wordpress nextcloud) behind a reverse proxy location in NGINX

if i use NGINX location / wordpress runs out of the box and nextcloud after some configuration in config.php in trusted domains.

So this config is working for both nginx and nextcloud. (i just have to change the ports.

server { server_name localhost; large_client_header_buffers 4 16k; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto http; proxy_set_header X-Forwarded-Host $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://10.0.100.6:8080; } listen [::]:80; listen 80; } 

But if I want to run them in different location i rly getting into trouble. I tried so many hints on the web since 2 days but nothing worked out from a blank screen over server error to not allowed to view the site etc.

Maybe you guys have some hints what i could try.

I already changed path in wordpress. Try to made proxy configuration on nextcloud ... nothing worked out.

Maybe someone have a running proxy configuration for nextcloud running NOT in / but in another location ? i tried these fix https://gist.github.com/aleksandar-babic/0cdd3244f4bf6b13dbed68de96ba4ab1 for wordpress but nothing worked out for me

I just use http for testing

someone experienced with reverse proxy with locations on nextcloud or wordpress would be fine :)

So what i already tried is this nginx configuration:

 server { server_name localhost; large_client_header_buffers 4 16k; location /nextcloud { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto http; proxy_set_header X-Forwarded-Host $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://10.0.100.6:8080; } listen [::]:80; listen 80; } 

Bringing me to this page:

Nextcloud Page not found

The page could not be found on the server or you may not be allowed to view it.

Back to Nextcloud

Nextcloud – a safe home for all your data

So reverse proxy is working but page not found:

In my opionion its just a configuration issue in config.php from nextcloud

So i read this: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/reverse_proxy_configuration.html

This is my config.php file for nextcloud:

 <?php $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, ), ), 'upgrade.disable-web' => true, 'instanceid' => 'ocd4tnvw6501', 'passwordsalt' => 'y0KSe+aYftr3ruAhjc8P+WME7/UBsV', 'secret' => 'ZCsLngn5eg+M9kkuPHInzt5H8APgWta20lPncnFR244WDxLW', 'trusted_domains' => array ( 0 => '10.0.100.6:8080', 1 => '10.0.100.6:80', 3 => '*', ), 'datadirectory' => '/var/www/html/data', 'dbtype' => 'mysql', 'version' => '28.0.1.1', 'overwrite.cli.url' => 'http://10.0.100.6/nextcloud', 'dbname' => 'db', 'dbhost' => 'mariadb', 'dbport' => '', 'dbtableprefix' => 'oc_', 'mysql.utf8mb4' => true, 'dbuser' => 'mysqluser', 'dbpassword' => 'somemysqlpassword', 'installed' => true, 'overwritewebroot' => '/nextcloud', 'trusted_proxies' => ['10.0.0.6'], 'overwritehost' => '10.0.0.6', ); 

I chanched trusted hosts

added this:

 'overwritewebroot' => '/nextcloud', 'trusted_proxies' => ['10.0.0.6'], 'overwritehost' => '10.0.0.6', 'overwrite.cli.url' => 'http://10.0.100.6/nextcloud', 

myabe its just a small configuration issue...

5
  • Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow. Commented Feb 1, 2024 at 16:07
  • Questions on Server Fault must be about managing information technology systems in a business environment. This is a question about a buisness enviroment . I'm working ion a DevOp enviroment where i want to automate docker applications . For example if i have if i have a new Development Team and this Team need a Blog , a Fileserver, and a Wiki, on one domain and than need an sqlserver test on another ip . I try to automate this with ansible and docker . And it works so far but rly struggeling with the reverse proxyconfiguration for the applications itself Commented Feb 1, 2024 at 16:26
  • Sorry, you do not convince me this is business environment. Commented Feb 1, 2024 at 16:34
  • If you want help provide a configuration you tried along with errors you encounter so people can tell you whats wrong. Nobody will guess your environment and write all config files for you. Commented Feb 1, 2024 at 18:02
  • Hey, yea added my configuration for nextcloud maybe you can watch over it ... ? i'm so stuck Commented Feb 2, 2024 at 10:12

1 Answer 1

0

I think your location block is missing a few directives. Try this

location /nextcloud { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto http; proxy_set_header X-Forwarded-Host $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://10.0.100.6:8080; client_max_body_size 0; proxy_redirect off; } 

The nextcloud config.php should also include this

'overwrite.cli.url' => 'http://your_domain.com/nextcloud', 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.