In a project I have very large nginx configuration with a lot of redundant lines.
The current state is like the following
location ~ /loc1/ {
common rules;
}
location ~ /some/other/location/ {
common rules;
}
location ~ /yet/anotherone {
common rules;
}
etc .....
What I'd like to have is seperated way where there is a generic rule template and a list of locations.
In other related questions people have used regex to match several locations like so
location ~ (/loc1/|/some/other/location/|/yet/anotherone) {
common rules;
}
In my case this would result in a huge line which would be very ugly to maintain.
Is there another cleaner way to do this?
Thank you very much.