I dealt with this last week and just resolved it.
I followed info from this link, https://techcommunity.microsoft.com/t5/apps-on-azure-blog/configure-nginx-for-php-8-linux-azure-app-service/ba-p/3069373 here's the details of what I did to get it working.
After you make the PHP changes, go into the KUDU console and SSH into the App Service.
Get to this in the web app > development tools > advanced tools > SSH at the top.
Once in the shell, cd to /etc/nginx and make sure it's there.
If you do an "ls" and see nginx.conf in there, you are in the right place and right config.
Copy the default config from nginx to your home directory
cp /etc/nginx/sites-enabled/default /home/default
cd to your home dir
cd /home
while you are here, modify the default file in /home/default
server {
client_max_body_size 10m;
.....
Create the startup script
nano startup.sh
Add this content to your startup.sh script (from this link, which was in the comments of the link above) https://www.schakko.de/2021/09/08/deploying-php-8-0-applications-with-azure-app-service/
#!/bin/bash
echo "Replacing nginx configuration for serving PHP 8.0-based applications"
cp /home/default /etc/nginx/sites-available/default
echo "Reloading nginx to apply new configuration"
service nginx reload
That will copy the new default file over to nginx on startup and for whatever reason, nginx needs to be reloaded. I am at a loss why it doesn't reload with the app service restart.
Tell the web app the script is executable (I just did this by habit, not sure if it's necessary)
chmod +x startup.sh
Now, all you need to do is tell the app to run the script at startup
In your web app > configuration > general settings, add this to your "Startup Command"
/home/startup.sh
Now, when you restart the web app service, it should launch that script at startup, copy the file over and reload nginx. You can tell it worked if you cd to /etc/nginx/sites-enabled/ and cat default to see the config file. There it should show your new config setting.
You can also see if it started nginx correctly with
nginx -t
and finally, this will show the entire nginx config, which should include your modification (the new line at the top of server{})
nginx -T
I hope this helps someone else!