Folder protection options can conflict with existing configured locations in nginx (locations merge problem)
The problem happens if the following both conditions are met:
- User configures a password protected folder in ISPConfig (Sites - Web Access - Protected Folders).
- The same folder is already configured in nginx (for example, in vhost template, directive snippets or web options).
In this case the locations are not merged by ISPConfig when it generates the final vhost configuration file. As a result, the file contains mupltiple locations that leads to nginx syntax error.
Example. Let's assume, we have "test" location configured in directive snippets:
location /test/ {
try_files $uri $uri/ /index.php?$args;
}
Then add "test" to the list of protected folders. The resulting configuration file that ISPConfig generates will be invalid:
location /test/ {
try_files $uri $uri/ /index.php?$args;
}
## some other nginx directives
location /test/ { ##merge##
auth_basic "Members Only";
auth_basic_user_file /var/www/clients/client1/web5/web/test/.htpasswd;
location ~ \.php$ {
try_files /89f314d371fa173948fcad289dd51f95.htm @php;
}
}
Discussion at Howtoforge