DirectAdmin Nginx error / bug

nservices

Verified User
Joined
Dec 11, 2008
Messages
301
Hi,
new server with CentOS 7, Nginx 1.8.0 and DA 1.48.0
adding few sub-domains under same user, and Directadmin say that it's duplicated location "/"
it's count the location per DA account and not per domain or sub-domain
Please check it...
 
Last edited:
Can you paste us the exact error message DA gives you?

Nginx only allows 1 "location" for a given path, per server entry.
I'm guessing there might be other things that want to use the / location, whether it be a password protected directory, nginx redirect, or perhaps a "Custom httpd Config" setting.

John
 
Hello John,

I can confirm that. If an user password protect public_html then nginx drops errors:

Code:
# nginx -t
nginx: [emerg] duplicate location "/" in /usr/local/directadmin/data/users/userbob/nginx.conf:35
nginx: configuration file /etc/nginx/nginx.conf test failed

here is user's config:

Code:
server{
        listen 1.2.3.4:80;
        server_name domain.com www.domain.com ;
        access_log /var/log/nginx/domains/domain.com.log;
        access_log /var/log/nginx/domains/domain.com.bytes bytes;
        error_log /var/log/nginx/domains/domain.com.error.log;
        root /home/admin/domains/suspended;
        index index.php index.html index.htm;
                location /
                {
                        access_log off;
                        proxy_pass http://127.0.0.1:8080;
                        proxy_set_header X-Client-IP      $remote_addr;
                        proxy_set_header X-Accel-Internal /nginx_static_files;
                        proxy_set_header Host             $host;
                        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                }
                location /nginx_static_files/
                {
                        access_log  /var/log/nginx/access_log_proxy;
                        alias       /home/admin/domains/suspended/;
                        internal;
                }
        location  /  {
                auth_basic              "locked";
                auth_basic_user_file    /home/userbob/domains/domain.com/.htpasswd/public_html/.htpasswd;
        }
...
...
...


and another user which is not suspended:

Code:
server
{
        listen 1.2.3.4:80;
        server_name domain2.com www.domain2.com ;
        access_log /var/log/nginx/domains/domain2.com.log;
        access_log /var/log/nginx/domains/domain2.com.bytes bytes;
        error_log /var/log/nginx/domains/domain2.com.error.log;
        root /home/userjeck/domains/domain2.com/public_html;
        index index.php index.html index.htm;
                location /
                {
                        access_log off;
                        proxy_pass http://127.0.0.1:8080;
                        proxy_set_header X-Client-IP      $remote_addr;
                        proxy_set_header X-Accel-Internal /nginx_static_files;
                        proxy_set_header Host             $host;
                        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                }
                location /nginx_static_files/
                {
                        access_log  /var/log/nginx/access_log_proxy;
                        alias       /home/userjeck/domains/domain2.com/public_html/;
                        internal;
                }
        location  /  {
                auth_basic              "test";
                auth_basic_user_file    /home/userjeck/domains/domain2.com/.htpasswd/public_html/.htpasswd;
        }
        # deny access to apache .htaccess files
        location ~ /\.ht
        {
                deny all;
        }
        include /etc/nginx/webapps.conf;
}
 
I guess it was my fault, I've converted the server to nginx+apache prior to upgrading Directadmin to the latest release, so it had outdated templates for nginx. After the Directadmin upgrade nginx is running fine.
 
Back
Top