ThomasSjdinDahl-8294 avatar image
0 Votes"
ThomasSjdinDahl-8294 asked ajkuma-MSFT answered

App Service PHP Stack image


Do you know if Azure App Service is still using this image for Stack Settings PHP 8.0?

Azure App Service’s PHP 8.0 Runtime Stack uses the nginx/php-fpm Docker image:

Link found on this page:


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered

@ThomasSjdinDahl-8294, Thanks for the great question. While I’m discussing this internally with our product engineering team.

It appears that there’s a directive missing in the Nginx configuration files.

port_in_redirect off;

Kindly update the Ngnix config and then check.

To better assist you on this, please provide more details about your scenario.
What specific issue are you experiencing? Do you receive any error messages?

Furthermore, Azure App Service on Linux images using PHP 8.x are now bundled with NGINX instead of Apache. The use of .htaccess files will not work for NGINX as these are used for Apache only. This will require the need to setup a custom startup script and modifying the existing NGINX site configuration.

Checkout this doc -Configuring NGINX Rewrite Rules for Azure App Service blessed images running PHP 8

Relevant discussion thread: Azure App Service: Unable to deploy PHP 8.0-based applications with Composer enabled

· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ajkuma-MSFT

Thanks for the answer.

I already had NGINX configured and it is working without any error messages.

The thing is that I have configured it manually.

I am using Terraform to deploy the structure and would like to add what I manually changed.

This is my Terraform site configuration:

site_config {
always_on = true
linux_fx_version = "PHP|8.0"
scm_type = "LocalGit"
ftps_state = "FtpsOnly"
app_command_line = "cp /home/site/repository/default /etc/nginx/sites-enabled/default; service nginx restart"

I'm trying to figure out if I can fork the image used for PHP|8.0 and add the rewrite rules there


0 Votes 0 ·
ajkuma-MSFT avatar image ajkuma-MSFT ThomasSjdinDahl-8294 ·

ThomasSjdinDahl-8294, Thanks for the follow-up and additional info.

Unfortunately, Nginx’s configuration must be performed before starting up the Nginx service inside the container, so it’s a little less flexible than Apache2’s .htaccess files.

So, yes you need to use custom startup script to overwrite original Nginx config file. (as you have already done).

From there, it’s a matter of copying their nginx.conf file over the existing /etc/nginx/nginx.conf and/or /etc/nginx/sites-available/default files, and then doing the equivalent of /opt/startup/ (in the PHP container).

As for as the parent image - you can find the parent (default image) source files for it-

Also, checkout - Configure Nginx for PHP 8 Linux Azure App Service.

1 Vote 1 ·

Thanks @ajkuma-MSFT

PHP 8 isn't listed on the supported platforms here:
Maybe they just haven't updated the list yet.

I understand then that this is the image used for PHP with NGINX:

0 Votes 0 ·
Show more comments

@ajkuma-MSFT Do you know if there are any plans on adding the configuration of NGINX rewrite rules and the startup script to the image used?

0 Votes 0 ·
Show more comments