[bug] DA 1.46.3, nginx_apache: ServerAlias is added into nginx_server_sub.conf

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
15,366
Location
www.poralix.com
Hello,


Directadmin:
[TABLE="class: list, width: 586"]
[TR]
[TD="class: list2"]Compile Date[/TD]
[TD="class: list2"]Oct 24 2014, 20:35:39[/TD]
[/TR]
[TR]
[TD]Server Version[/TD]
[TD]1.46.3[/TD]
[/TR]
[/TABLE]


[root@shared custombuild]# ./build version
2.0.0-RC7 (rev: 1076)


Let's say we have:

1. domain.com
domain2.com, domain3.com as aliases to domain.com

2. domain.com has subs:
sub1, sub2, sub3.

Thus we have

domain.com with aliases: domain2.com, domain3.com
sub1.domain.com with aliases: sub1.domain2.com, sub1.domain3.com
sub2.domain.com with aliases: sub2.domain2.com, sub2.domain3.com
sub3.domain.com with aliases: sub3.domain2.com, sub3.domain3.com

Directadmin completely wrong sets aliases in /usr/local/directadmin/data/templates/nginx_server_sub.conf
a new line with ServerAlias is added (from apache version I guess):
we've got:

Code:
server_name sub1.domain.com www.sub1.domain.com
ServerAlias sub1.domain1.com www.sub1.domain1.com sub1.domain2.com www.sub1.domain3.com sub1.domain3.com www.sub3.domain.com;


And nginx warns about:
Code:
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
nginx: [warn] conflicting server name "serveralias" on 11.22.33.44:80, ignored
 
As a temp solution we did a replace:

Code:
        server_name |SUB|.|DOMAIN| www.|SUB|.|DOMAIN| |SERVER_ALIASES|;

with

Code:
|$/usr/local/bin/php
<?php
$data = <<<END
        server_name |SUB|.|DOMAIN| www.|SUB|.|DOMAIN| |SERVER_ALIASES|;
END;
$data = str_replace("\n", "", $data);
$data = str_replace("ServerAlias", "", $data);
echo  $data;
?>
DONE|

in /usr/local/directadmin/data/templates/custom/nginx_server_sub.conf
 
I found the following issue that closely matches this question:

On one of our servers the customer added ServerAlias in the Apache custom config instead of adding the domains as domain pointers.
We converted this server to nginx_apache which breaks all ServerAlias domains (as Nginx does not have a configuration for these aliasses).
I tried to convert the ServerAlias lines into server_name, but this didn't work as the main domain is added in a server_name and through the custom config a second line with server_name is added, which wasn't accepted by Nginx as a valid configuration.

Any idea how to solve this? Or is adding the domains named in the ServerAlias Apache config as domain pointer the only option?
 
Back
Top