I'm using dokku (small heroku) on host with nginx, my container is using apache and it's exposing port 8052.
This is configuration inside of .conf which is enabled and works fine:
LISTEN 8052
<VirtualHost *:8052>
ServerAdmin veeenex@localhost
DocumentRoot /var/www
<Directory />
Options +FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
allow from all
</Directory>
FCGIWrapper /phpfarm/inst/php-5.2/bin/php-cgi .php
AddHandler fcgid-script .php
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And this is configuration on host
upstream katalog.domain.eu {
server 172.17.0.3:8052;
}
server {
listen [::]:80;
listen 80;
server_name katalog.domain.eu;
access_log /var/log/nginx/katalog.domain.eu-access.log;
error_log /var/log/nginx/katalog.domain.eu-error.log;
location / {
proxy_pass http://katalog.domain.eu;
proxy_http_version 1.1;
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_redirect http://172.17.0.3:8052 https://katalog.domain.eu;
}
include /home/dokku/katalog.domain.eu/nginx.conf.d/*.conf;
}
It's working - because I can see the website on http://katalog.domain.eu, but if you click on any form, that makes action (POST,...) url like http://katalog.domain.eu/index changes to http://katalog.domain.eu:8052/index
I've already tried different proxy_set_headers but none of them worked. I don't want to open another port on server, to fix this.