Skip to content

Commit

Permalink
Also use th new options to listen on all IPs and support http2
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Dec 18, 2020
1 parent e34f77a commit 6157c69
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions virtual_feature.pl
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,27 @@ sub feature_setup
else {
push(@sslopts, 'ssl');
}
if (!$old_ip4) {
push(@listen, { 'name' => 'listen',
'words' => [ $d->{'ip'}.":".$d->{'web_sslport'},
@sslopts ] });
push(@sslopts, "http2") if ($virtualmin_nginx::config{'http2'});
if ($virtualmin_nginx::config{'listen_mode'}) {
# Listen on all IPs
if (!$old_ip4 && !$old_ip6) {
push(@listen, { 'name' => 'listen',
'words' => [ $d->{'web_sslport'},
@sslopts ] });
}
}
if (!$old_ip6 && $d->{'ip6'}) {
push(@listen, { 'name' => 'listen',
'words' => [ "[".$d->{'ip6'}."]:".$d->{'web_sslport'},
@sslopts ]});
else {
# Add on specific IPs
if (!$old_ip4) {
push(@listen, { 'name' => 'listen',
'words' => [ $d->{'ip'}.":".$d->{'web_sslport'},
@sslopts ] });
}
if (!$old_ip6 && $d->{'ip6'}) {
push(@listen, { 'name' => 'listen',
'words' => [ "[".$d->{'ip6'}."]:".$d->{'web_sslport'},
@sslopts ]});
}
}
&virtualmin_nginx::save_directive($server, "listen", \@listen);

Expand Down Expand Up @@ -292,6 +304,9 @@ sub feature_modify
$w[0] =~ s/:\d+$//;
$w[0] .= ":".$d->{'web_sslport'};
}
elsif ($w[0] eq $oldd->{'web_sslport'}) {
$w[0] = $d->{'web_sslport'};
}
push(@newlisten, { 'words' => \@w });
}
&virtualmin_nginx::save_directive($server, "listen", \@newlisten);
Expand Down Expand Up @@ -480,6 +495,8 @@ sub feature_validate
$d->{'web_sslport'} == 80 ||
$l =~ /^\Q$d->{'ip'}\E:(\d+)$/ &&
$d->{'web_sslport'} == $1);
$found++ if ($l eq $d->{'web_sslport'} &&
$virtualmin_nginx::config{'listen_mode'});
}
$found || return &virtualmin_nginx::text('feat_evalidateip',
$d->{'ip'}, $d->{'web_sslport'});
Expand All @@ -490,6 +507,8 @@ sub feature_validate
$d->{'web_sslport'} == 80 ||
$l =~ /^\[\Q$d->{'ip6'}\E\]:(\d+)$/ &&
$d->{'web_sslport'} == $1);
$found6++ if ($l eq $d->{'web_sslport'} &&
$virtualmin_nginx::config{'listen_mode'});
}
$found6 || return &virtualmin_nginx::text('feat_evalidateip6',
$d->{'ip6'}, $d->{'web_sslport'});
Expand Down

0 comments on commit 6157c69

Please sign in to comment.