0

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)

0 Answers0