On my server, I have a custom rule in the nginx templates inside the location / { block:
include %home%/%user%/conf/web/%domain%/rules.conf*;
I then (if I need it) can include a rules.conf file that contains the rules for the domain. This works fine for me, but I wonder if it would be helpful for others as well? A bit like we have:
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
So its not required, but is included in the nginx templates if you want to make use of it. The reason I bring it up, is that I was just moving a site to another Hestia server. The rules.conf file wasn’t copied over. Looking in v-backup-user, we do:
# Backup vhost config
if [ -e "$HOMEDIR/$user/conf/web/$domain/$WEB_SYSTEM.conf" ]; then
cp $HOMEDIR/$user/conf/web/$domain/$WEB_SYSTEM.conf* conf/
elif [ -e "$HOMEDIR/$user/conf/web/$domain.$WEB_SYSTEM.conf" ]; then
cp $HOMEDIR/$user/conf/web/$domain.$WEB_SYSTEM.conf* conf/
else
# legacy format: all domain configs in single file
tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.tpl"
conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf"
get_web_config_lines "$tpl_file" "$conf"
sed -n "$top_line,$bottom_line p" $conf > conf/$WEB_SYSTEM.conf
fi
So it actually only looks for specific files. My thinking is that if we add in:
if [ -e "$HOMEDIR/$user/conf/web/$domain/rules.conf" ]; then
cp $HOMEDIR/$user/conf/web/$domain/rules.conf* conf/
fi
This would then back that up as well. I guess a similar tweak would be needed in the restore process as well. What do people think? If it worth creating a PR with the updated templates + backup/restore functions?
haha wow, I didn’t know that! I just tested it on a smaller site, and it seems to work. Maybe that was just a hangover from when I used to use Vesta (and there wasn’t that extra file)
That’ll make things easier! (although now, I’ve got to go through and edit and test all the places I use rules.conf )
If I put the rewrites in nginx.ssl.conf_rules , then that takes president and the above code is never run - which results in a 404. not sure if there is any way around that?