Open junalmeida opened 8 years ago
You should be able to just add the subdir to all the rewrite rules, and place most of the config in your existing server
block. Definitely try it out and let me know if it works :)
In my docker image I'm actually using a script to patch the NGINX configuration on the fly based on an environment variable used on docker run
:
if [ -z ${BASE_URL+false} ]
then
echo "Using base URL: /"
else
CONFIGFILE=/etc/nginx/conf.d/nuget.conf
echo "Using base URL: $BASE_URL"
perl -pi -e "s#rewrite \^(?!$BASE_URL)/#rewrite ^$BASE_URL/#g" $CONFIGFILE
perl -pi -e "s#location = (?!$BASE_URL)/#location = $BASE_URL/#g" $CONFIGFILE
fi
It basically patchesnginx.conf
from
rewrite ^/$ /index.php;
to
rewrite ^/some-configurable-path$ /index.php;
As title.