Hosting on docker with Nginx reverse proxy

Hi kirby community,

my client has a quite complex setup and we ran into some problems with that.
They run several docker containers and an Nginx reverse proxy in front of it. We installed a new Docker container with PHP5.6, Apache and mbstring extension. Then I cloned my git repo that has all kirby files and folders, including my site and assets.

The problem:
Images are running into 404 (not found)
Another symptom is that the panel is not accessible. The server times out.

I know this is very vague and I don’t have direct access to the server unfortunately. Can you maybe make an educated guess on what might be the issue?

  • Sven

Hi August,

my initial description of the problem was wrong and I edited it now. There is no problem with the way URLs/URIs are generated. For your information: ->url() generates an absolute path and ->uri() generates a relative path. Sorry for the confusion.

I am starting to think that it has to be the reverse proxy settings.

What kind of file URLs do you get after the reverse proxy? Regarding the Panel issue: Does it only affect the Panel? If so, does it work without the reverse proxy?

The generated URLs look like that:
domain.com/home/slide/cabrio.jpg

The same code on my local machine with mamp works like a charm

What kind of 404 do you get? One from Kirby or one from nginx? Could be that nginx does not properly forward requests to Kirby. Those file URLs without the content directory in the path only work with Kirby.

Looks like they come from Nginx

Response Header:

Server:nginx/1.4.6 (Ubuntu)

The Server header is sent always, even for PHP responses. Can you make a screenshot of the 404 page if you access the file URLs directly?

Looks like apache here?

Well, that’s interesting. Is Apache the server running PHP in your setup? If so, have you uploaded the .htaccess file?

Yes and yes (Will tell the guy that has server access tell to verify if the htaccess is in the right place).

We have reached a point where the site is generated successfully.

The panel is showing the form for creating the first user. But the form has a wrong action target.

<form method="post" action="http://127.0.0.1:8999/panel/install" class="form" autocomplete="off" data-autosubmit="native">

I searched all the google and all I found is putting c::set('panel.install', true); into the config. Is that what I have to do?


Edit:

I have uploaded ./site/accounts/myUser.php too. So the install page shouldn’t show up?

You can set c::set('url', 'http://example.com') to override the auto-detected URL (which won’t be detected correctly behind the reverse proxy).

1 Like

This is my config now:

<?php
c::set('license', 'put your license key here');
c::set('url', 'https://www.mydomain.de/myPage');
c::set('panel.install', true);

All images are using the new base-url. But the panel login form redirects to 127.0.0.1:8999 still.

Is that normal?

Which Kirby version are you using? I think that issue has been fixed.

I am using Kirby 2.3.2

Should be the latest?!

Yes, that’s the latest version. I will do some tests later today.

I can reproduce this issue and have opened a GitHub issue for it. We will look into it for Kirby 2.4.