Web app - NGINX configuration resets to default

Nuno Vicente 40 Reputation points
2023-06-16T13:14:30.58+00:00

From time to time NGINX is loosing all configurations and resets to default. I'm making the configurations through the SSH terminal.

cp /home/default /etc/nginx/sites-available/default

All goes well for a couple of days and then it goes back to default. Any reason why?

Thanks in advance.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
{count} votes

Answer accepted by question author
  1. SnehaAgrawal-MSFT 22,721 Reputation points Moderator
    2023-06-19T14:42:51.8566667+00:00

    @Nuno Vicente Thanks for reaching here! If I have understood right you want to create your own customized Nginx configuration based on the default one. Please double check on the below steps to be followed.

    1. Copy the default Nginx configuration file located at /etc/nginx/sites-enabled/default to the /home folder.
    2. Since /home files are persisted in Azure Storage, ensure that your custom Nginx configuration file is saved under /home to survive restarts and be shared across instances.
    3. Access the App Service WEBSSH via https://<AppServiceName>.scm.azurewebsites.net/webssh/host.
    4. Modify the Nginx configuration by making changes to the /home/default file.
    5. Use a custom startup script to overwrite the original Nginx configuration file, allowing the platform to use your customized configuration each time the App Service starts.
    6. In the App Service Portal, navigate to "Configuration" -> "General settings" and add the following command in the "Startup Command" field and save the setting. cp /home/default /etc/nginx/sites-enabled/default; service.

    User's image

    For more details- see- Configure Nginx for PHP 8 Linux Azure App Service

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Chiang, Howard [DPYUS] 0 Reputation points
    2025-07-15T17:01:22.13+00:00

    My CI/CD system deploys with terraform invoking az webapp deploy --type zip. This call resets the /home/nginx/nginx.conf, /home/nginx/site-available/, /home/nginx/sites-enabled/, and the azure startup command

    This makes it impossible to set nginx configuration without manual input after az webapp deploy
    This blocks automated deployment...

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.