Issue with Nginx config file generated by DA.

rko4all

New member
Joined
Jul 12, 2025
Messages
3
Hello Dear DirectAdmin Community ,

I used the following commands to switch Apache to nginx_apache in directadmin :

Code:
da build set webserver nginx_apache
da build nginx_apache
da build php
da build rewrite_confs

After the process , I noticed an Nginx error :

Code:
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.

Upon further investigation , I noticed duplicate lines in /etc/nginx/nginx-vhosts.conf :

Code:
        listen       88.88.88.88:80;
        listen          127.0.0.1:80;
        listen       127.0.0.1:80;
        listen       [::1]:80;

and

Code:
        listen       88.88.88.88:443 ssl;
        listen          127.0.0.1:443 ssl;
        listen       127.0.0.1:443 ssl;
        listen       [::1]:443 ssl;

as you can see , there are duplicate lines for listen 127.0.0.1:80; and listen 127.0.0.1:443 ssl; .

Now , I can manually edit the file and save it but upon running da build rewrite_confs , the generated file again contains the duplicate entries .

Below is the full config file /etc/nginx/nginx-vhosts.conf :

Code:
   server {
        listen       88.88.88.88:80;
        listen          127.0.0.1:80;
        listen       127.0.0.1:80;
        listen       [::1]:80;

        server_name  $hostname 88.88.88.88;

        root   /var/www/html;

        location / {
                access_log off;
                proxy_pass http://88.88.88.88: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;
                proxy_hide_header Upgrade;
        }

        location /nginx_static_files/ {
                access_log  /var/log/nginx/access_log_proxy;
                alias       /var/www/html/;
                internal;
        }

        # deny access to .htaccess, .env and .user.ini files
        location ~ /(\.ht|\.env|\.user\.ini) {
                deny  all;
        }

        include /etc/nginx/nginx-info.conf;
        include /etc/nginx/webapps.hostname.conf;
    }

    # HTTPS server
    #
    server {
        listen       88.88.88.88:443 ssl;
        listen          127.0.0.1:443 ssl;
        listen       127.0.0.1:443 ssl;
        listen       [::1]:443 ssl;
        http2 on;

        server_name  $hostname 88.88.88.88;

        ssl_certificate         /etc/httpd/conf/ssl.crt/server.crt.combined;
        ssl_certificate_key     /etc/httpd/conf/ssl.key/server.key;

        root   /var/www/html;

        location / {
                access_log off;
                proxy_pass https://88.88.88.88:8081;
                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;
                proxy_hide_header Upgrade;
        }

        location /nginx_static_files/ {
                access_log  /var/log/nginx/access_log_proxy;
                alias       /var/www/html/;
                internal;
        }

        # deny access to .htaccess, .env and .user.ini files
        location ~ /(\.ht|\.env|\.user\.ini) {
                deny  all;
        }

        include /etc/nginx/nginx-info.conf;
        include /etc/nginx/webapps.hostname.conf;
    }

How can I figure out what's causing the duplicate lines ? Thank you .

Kind Regards ,
 
@zEitEr

Here is how the IPs and Devices tabs look like in IP Management section . See attached pictures .

I don't think anything is wrong with that . The only 127.0.0.1 I edited was one to bind mysql to local connections . Can't recall using that anywhere else .
 

Attachments

  • ipmanagement1.PNG
    ipmanagement1.PNG
    19.4 KB · Views: 8
  • ipmanagement2.PNG
    ipmanagement2.PNG
    19.5 KB · Views: 8
If your DA license includes official support, then you'd better open a ticket with DA support and let them to investigate it for you.

In other case check whether you have custom templates under /usr/local/directadmin/data/templates/custom/ and/or other custom directives in /usr/local/directadmin/data/users/*/domains/*cust*
 
@zEitEr

It's a fresh installation of DirectAdmin . I will check what you said to see if custom templates exist . My license includes official support . I will open a ticket with DA if I fail to solve it myself . It's just weird . I used to have DA on CentOS 7 a while ago but since it was challenge to update the OS , I decided to move to Ubuntu.
 
Back
Top