lamnian
September 29, 2022, 9:41am
1
Hello,
When adding or changing web domains, NGINX will not auto restart. I have to go and do it manually. This is especially a problem when I add let’s encrypt certificates.
Running nginx -t
I get the following:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
This and the fact that I can restart it manually both from the command line and the panel shows that it is not a problem with the config.
Any Ideas?
eris
September 29, 2022, 10:17am
2
If you do it via the admin we should always restart nginx.
Via CLI / API make sure to add the restart flag
#!/bin/bash
# info: add web domain
# options: USER DOMAIN [IP] [RESTART] [ALIASES] [PROXY_EXTENSIONS]
#
# example: v-add-web-domain admin wonderland.com 192.18.22.43 yes www.wonderland.com
#
# This function adds virtual host to a server. In cases when ip is
# undefined in the script, "default" template will be used. The alias of
# www.domain.tld type will be automatically assigned to the domain unless
# "none" is transmited as argument. If ip have associated dns name, this
# domain will also get the alias domain-tpl.$ipname. An alias with the ip
# name is useful during the site testing while dns isn't moved to server yet.
#----------------------------------------------------------#
# Variables & Functions #
#----------------------------------------------------------#
# Argument definition
user=$1
domain=$2
This file has been truncated. show original
And
exec(HESTIA_CMD."v-list-user ".$user." json", $output, $return_var);
$user_config = json_decode(implode('', $output), true);
unset($output);
$v_template = $user_config[$user_plain]['WEB_TEMPLATE'];
$v_backend_template = $user_config[$user_plain]['BACKEND_TEMPLATE'];
$v_proxy_template = $user_config[$user_plain]['PROXY_TEMPLATE'];
// Add web domain
if (empty($_SESSION['error_msg'])) {
exec(HESTIA_CMD."v-add-web-domain ".$user." ".quoteshellarg($v_domain)." ".$v_ip." 'yes'", $output, $return_var);
check_return_code($return_var, $output);
unset($output);
$domain_added = empty($_SESSION['error_msg']);
}
if (empty($_POST['v_dns'])){
$_POST['v_dns'] = 'no';
}
if (empty($_POST['v_mail'])){
$_POST['v_mail'] = 'no';
lamnian
September 29, 2022, 10:13pm
3
I do it through the admin only…