Azure Linux Startup Command ignored

1.3k Views Asked by At

I'm facing to a problem with Azure Wordpress on App Service, the Startup Command is ignored when I perform a restart of App service. I need to copy a custom config file into nginx directory as described in the article Configure Nginx for PHP 8 Linux Azure App Service.

Configuration

Here is the content of startup.sh script:

#!/bin/bash
        
cp /home/spec-settings.conf /etc/nginx/conf.d/spec-settings.conf
service nginx restart

Do someone have any idea what might be wrong?

3

There are 3 best solutions below

0
On

To resolve the problem "Azure Linux Startup Command ignored" try below workarounds:

Workaround1:

To copy a custom config file into nginx directory use custom startup script. According to the documentation you are following, you need to give the below command in startup command field:

cp /home/default /etc/nginx/sites-enabled/default; service nginx restart

Save the setting after changing the Startup Command. This makes the App service to restart.

Workaround2:

If you dont want to give startup command in that field, leave the existing value you entered and try below:

  • Create a custom script as below and save it as /home/site/startup.sh
cp /home/site/default /etc/nginx/sites-available/default
service nginx restart

Now, For the Startup Command enter /home/site/startup.sh , and save the setting and navigate your application.

  • If the above workarounds doesn't work, try using reload instead of restart.
cp /home/spec-settings.conf /etc/nginx/conf.d/spec-settings.conf
service nginx reload

For more in detail, please refer below link:

NGINX Rewrite Rules for Azure App Service Linux PHP 8.x - (azureossd.github.io).

1
On

I also got this problem. In my case I created the startup script on a Windows computer which causes the problem. When I changed the format to Unix (e.g. with Notepad++), the startup script was executed.

0
On

I tried all sort of StartUp Scripts and Start Up Commands but I then noticed that my Start Up Command was being ignored. I had a Wordpress Web App Service and wanted to modify the nginx.conf as well. After a lot of hours restarting the App and editing containers I noticed that the App by default has a file located in /home/dev/startup.sh. I edited the file and inputted the below commands and after the next restart all worked on its own. I did not even need to input any start up command. This file is by default executed by the app on restart.

Please also note that my nginx default config was located in /etc/nginx/conf.d/default.conf

cp /home/dev/nginx.conf /etc/nginx/conf.d/default.conf
/usr/sbin/nginx -s reload

After setting up both /home/dev/nginx.conf and editing /home/dev/startup.sh you can restart the app and test any of your rules.