Overwrite Nginx Config

Hi there,
i am currently moving a website from on-prem to Azure App Service running Kirby (https://getkirby.com).

TLDR: Is it possible to override the nginx port rounting, without changing the listening port ?

Azure App Service allows different runtimes to be used, to meet our current version running on premise, php 8.2 is choosen as the runtime. Azure provides a linux container, with the Web Root in /home. All Data outside this directory is not persistent and is going to be deletet after a restart.
This runtime comes with nginx . The nginx config is in ‘/etc/’ so it gets erased after rebooting.

Through a workaround it is possible to alter the nginx configuration, every time the container reloads. A shell script is saved in a persistent directory and run after booting.

The altering of the nginx configuration is neccessary for Kirby to work. as it takes control over routing.
The nginx config running is listening on port 8080. When using this, all content is available over https, as Azure is kind of a proxy infront of the service.

Now to the problem: Kirby creates URL’s on itself and uses all the information available in the nginx configuration file, especially the port 8080 - all url’s are now using http and port 8080: f.x.


The Website is loaded using “https” but the contect provided from kirby is routet using the nginx config.

The content, is available at (with https & port removed):


Is it possible to overwrite this ?

What i have tried:

“Return 301” / “Redirect” / “proxy_pass” is not possible as i then get the error for too many redirects, even if i filter only the important ones.

Provide SSL Certificate and let the Nginx listen over 443. This does not work as well, as Azure apperantly does not allow this procedure. When changing the listening port and providing certs, the website is not available with the error code 502, bad gateway.

Thank you for reading, if you want to try it out yourself, you just need an app service and clone this repo to this dir: /home/site/wwwroot/