Score:0

replacing nginx config on container restart

ua flag

as I want to automatically handle redirection of https://site/page to https://site/page.php I've got an updated ngnix config that includes

location / {            
    try_files $uri $uri/ $uri.php?$query_string;
}

as the Azure web app container isn't persistent, I need to overwrite the /etc/nginx/sites-available/default at startup (and following a deployment from GitHub).

If I include a restart.sh script as follows in the root directory of my site project folder:

#!/bin/bash

echo "Replacing nginx configuration"
cp /home/site/repository/default /etc/nginx/sites-available/default
echo "Reloading nginx"
service nginx reload

and reference it as the startup command for the webapp in the portal as /home/site/repository/restart.sh it doesn't seem to run at startup. If I change the repository reference to wwwroot in the script and path to call it, same problem. If I call the wwwroot one from SSH after a deployment it does work.

for now I've moved both the default config and the script into \home and they do get applied correctly - which makes me think I've got an issue with the path and what's available at that stage in a deployment.

I'd prefer not to maintain the config/script outside of the GitHub project so:

  1. am I missing something and just need a different path/reference structure
  2. is there an easier/better way to handle the redirection (though I imagine we're going to need some other nginx config tweaks later on)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.