nginx_apache: possible bug: duplicate location "/"

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,932
Location
GMT +7.00
Hello,

Just switching another server of a customer and faced an issue with nginx_apache:

Code:
[root@server init.d]# service nginx restart
nginx: [emerg] duplicate location "/" in /usr/local/directadmin/data/users/userbob/nginx.conf:107
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@server init.d]#
That's what we have in 107th line:

Code:
        location  /  {
                auth_basic              "SECRET PLACE";
                auth_basic_user_file    /home/userbob/domains/bobs.domain.com/.htpasswd/public_html/.htpasswd;
        }
We removed the block and nginx started OK, and still apache does all the things to care about auth.

More to say enabling/disabling password protected directory in Directadmin does not affect or touch nginx.conf file of the user.

Compiled on 'CentOS 5.10 64-bit'
Compile time: Jul 1 2014 at 02:12:15
Compiled with IPv6



So, I guess we do not need that auth_basic in NGINX when it's used as a reverse proxy.
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
8,478
Location
LT, EU
Thank you for the report, the issue about password protection with nginx+apache was already known, however, not the location "/" one. What was the folder name which was protected? Was it the main public_html folder? :)
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,961
Hmm... I can comment out the PROTECTED_DIRECTORIES token.. basically just change
Code:
|PROTECTED_DIRECTORIES|
to be:
Code:
|*if HAVE_NGINX_PROXY!="1"||PROTECTED_DIRECTORIES||*endif|
However, the previous bug was mentioned here:
https://www.directadmin.com/features.php?id=1621

which was causing php scripts to send the script source... however, I have a feeling that only applied to standalone nginx, and not the proxy setup.

If you can confirm that changing the 4 templates in the above manner still allows php to work, I can make the changes permanent:
Code:
nginx_server.conf
nginx_server_secure.conf
nginx_server_secure_sub.conf
nginx_server_sub.conf
when I just tested it, php did work, and as you had discovered, apache handled all of the protected folders via .htaccess files.

Let me know and I'll change the templates.

John
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,932
Location
GMT +7.00
Hello John,

With updated templates and pre-release binary

Code:
[root@server directadmin]# /usr/local/directadmin/directadmin o
Compiled on 'CentOS 6.0 64-Bit'
Compile time: Aug 17 2014 at 20:49:13
Compiled with IPv6
it seems to work fine. Thank you.
 
Top