Protected Folders: duplicate location problem (nginx)

Discussion in 'Installation/Configuration' started by r@m, Apr 19, 2017.

  1. r@m

    r@m New Member

    Hi! I use nginx 1.11.13 with ISPConfig 3.1. I have a directive snippet with location block:
    Code:
    location / {
                    try_files $uri $uri/ /index.php?$args;
            }
    I want to create a protected "root" folder, i.e. "/". After I configure it in ISPConfig, I see that the new nginx vhost config becomes invalid and is not applied. The reason is that it contains 2 location blocks for "/" (nginx doesn't allow that):
    Code:
    location / {
                    try_files $uri $uri/ /index.php?$args;
            }
    
    ###
    # some other nginx directives
    ###
    
    location / { ##merge##
                    auth_basic "Members Only";
                    auth_basic_user_file /var/www/clients/client1/web3/web/.htpasswd
    
                    location ~ \.php$ {
                        try_files /aadedef43d867c0738663b0445264c50.htm @php;
                    }
            }
    It seems that the location "/" is not merged. Is it a bug or I do something wrong?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    It might be that the / can not be merged. But it can also be that this typo is causing it: Try to remove the whitespace between { and ##merge##
     
  3. r@m

    r@m New Member

    Thank you very much for a prompt response! I made another test and used "test" folder instead of "/" location:
    Code:
    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;
                    }
            }
    The results are the same: still duplicate location error from nginx. FYI, the second location with ##merge## parameter was generated automatically by ISPConfig (not me!), if I enable the folder protection (Sites - Web Access - Protected Folders). I also tried to manually adjust and remove the space before ##merge## - no luck, still the same. Could it be a bug that the processing of ##merge## directive by ISPConfig is not performed for protected folders?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    It's possible that you can override static config parts only and not dynamically generated as they probably get inserted into the file after the merging. Feel free to make a feature request in the bug tracker to make dynamically generated parts overridable again.
     
  5. r@m

    r@m New Member

Share This Page