# Hosting on docker with Nginx reverse proxy

**URL:** https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308
**Category:** Hosting
**Tags:** v2
**Created:** [September 21, 2016, 4:41pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308 "2016-09-21T16:41:54Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![0xSven](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/0xsven/32/2973_2.png) [@0xSven](https://forum.getkirby.com/u/0xSven)
#### Post date: [September 21, 2016, 4:41pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/1 "2016-09-21T16:41:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![0xSven](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/0xsven/32/2973_2.png) [@0xSven](https://forum.getkirby.com/u/0xSven)
#### Post date: [September 21, 2016, 5:31pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/3 "2016-09-21T17:31:27Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)
#### Post date: [September 21, 2016, 5:35pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/4 "2016-09-21T17:35:59Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![0xSven](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/0xsven/32/2973_2.png) [@0xSven](https://forum.getkirby.com/u/0xSven)
#### Post date: [September 21, 2016, 5:39pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/5 "2016-09-21T17:39:18Z")

</div>

The generated URLs look like that:  
[domain.com/home/slide/cabrio.jpg](http://domain.com/home/slide/cabrio.jpg)

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

---

<div class="post-metadata">

### Author: ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)
#### Post date: [September 21, 2016, 5:42pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/6 "2016-09-21T17:42:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![0xSven](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/0xsven/32/2973_2.png) [@0xSven](https://forum.getkirby.com/u/0xSven)
#### Post date: [September 21, 2016, 5:44pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/7 "2016-09-21T17:44:12Z")

</div>

Looks like they come from Nginx

Response Header:

> Server:nginx/1.4.6 (Ubuntu)

---

<div class="post-metadata">

### Author: ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)
#### Post date: [September 21, 2016, 6:03pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/8 "2016-09-21T18:03:29Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![0xSven](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/0xsven/32/2973_2.png) [@0xSven](https://forum.getkirby.com/u/0xSven)
#### Post date: [September 21, 2016, 6:33pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/9 "2016-09-21T18:33:59Z")

</div>

Looks like apache here?

![](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/2/2ea9cb679c7054f04a3b655301baf1e928cc154e.png)

---

<div class="post-metadata">

### Author: ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)
#### Post date: [September 21, 2016, 7:16pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/10 "2016-09-21T19:16:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![0xSven](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/0xsven/32/2973_2.png) [@0xSven](https://forum.getkirby.com/u/0xSven)
#### Post date: [September 21, 2016, 7:32pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/11 "2016-09-21T19:32:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![0xSven](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/0xsven/32/2973_2.png) [@0xSven](https://forum.getkirby.com/u/0xSven)
#### Post date: [September 29, 2016, 8:51am UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/12 "2016-09-29T08:51:24Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)
#### Post date: [September 29, 2016, 9:45am UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/13 "2016-09-29T09:45:05Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![0xSven](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/0xsven/32/2973_2.png) [@0xSven](https://forum.getkirby.com/u/0xSven)
#### Post date: [September 30, 2016, 12:56pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/14 "2016-09-30T12:56:34Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)
#### Post date: [September 30, 2016, 1:23pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/15 "2016-09-30T13:23:48Z")

</div>

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

---

<div class="post-metadata">

### Author: ![0xSven](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/0xsven/32/2973_2.png) [@0xSven](https://forum.getkirby.com/u/0xSven)
#### Post date: [September 30, 2016, 2:56pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/16 "2016-09-30T14:56:44Z")

</div>

I am using Kirby 2.3.2

Should be the latest?!

---

<div class="post-metadata">

### Author: ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)
#### Post date: [September 30, 2016, 4:34pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/17 "2016-09-30T16:34:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)
#### Post date: [October 1, 2016, 1:37pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/18 "2016-10-01T13:37:40Z")

</div>

I can reproduce this issue and have opened a [GitHub issue](https://github.com/getkirby/panel/issues/928) for it. We will look into it for Kirby 2.4.

---

<div class="post-metadata">

### Author: ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)
#### Post date: [February 6, 2025, 4:55pm UTC](https://forum.getkirby.com/t/hosting-on-docker-with-nginx-reverse-proxy/5308/19 "2025-02-06T16:55:09Z")

</div>


