Trying to create domain but fail in the process.
When creating the domain it fail to restart nginx show me this error “Error: nginx restart failed”.
Because the error say me nothing and no error show in the nginx logs i try to add manualy.
v-add-web-domain 'user' 'domain.com' '1.1.1.1' 'yes'
grep: warning: ? at start of expression
grep: warning: ? at start of expression
Error: nginx restart failed
Debian 12.1
v1.8.7
sahsanu
September 10, 2023, 8:00pm
2
You could try to debug the script, try this:
bash -x v-add-web-domain 'user' 'domain.com' '1.1.1.1' 'yes'
There are seems two errors
warning: ? at start of expression
This error come from here.
grep -E 'listen.*\s\bssl\b(?:\s)*.*;' /home/user/conf/web/domain.com/apache2.conf
grep: warning: ? at start of expression
grep -E 'listen.*\s\bssl\b(?:\s)*.*;' /home/user/conf/web/domain.com/nginx.conf
grep: warning: ? at start of expression
The other one come with the command v-restart-proxy yes
Unfortunately I can’t find anything here. Only see send error to email but not see what cause it.
send_email_report
grep CONTACT /usr/local/hestia/data/users/admin/user.conf
email='CONTACT='\''[email protected] '\'''
'CONTACT='\''[email protected] '\'''
cut -f 2 -d \'
[email protected]
mktemp
tmpfile=/tmp/tmp.3dMFSrpPY8
hostname
subj='host.domain.com: nginx restart failed'
nginx -t
'[' '' == DO_RESTART ']'
cat /tmp/tmp.3dMFSrpPY8
/usr/local/hestia/web/inc/mail-wrapper.php -s 'host.domain.com: nginx restart failed' [email protected]
sahsanu
September 10, 2023, 11:03pm
5
It is a warning but as far as I know, the expression works. The grep command is using extended regex -E
but for some reason it is trying to use a non-capturing group (?:\s)
that is not available in extended regex -E
but it is in perl regex -P
. Anyway, I don’t think that is the problem.
What is the output of nginx -t
The site is actually created?
I see why fail restart nginx.
if [ -f "$HESTIA/web/inc/nginx_proxy" ]; then
# if hestia is behind default nginx, restart in background with 15 sec delay
# background restart
if [ "$1" = 'background' ]; then
# Restart system
sleep 15
# Preform a check if Nginx is valid as reload doesn't throw an error / exit
if [ "$DEBUG_MODE" = "true" ]; then
echo "[ $date | $PROXY_SYSTEM ]" >> /var/log/hestia/debug.log 2>&1
service $PROXY_SYSTEM configtest >> /var/log/hestia/debug.log 2>&1
else
service $PROXY_SYSTEM configtest > /dev/null 2>&1
fi
if [ $? -ne 0 ]; then
send_email_report
check_result "$E_RESTART" "$PROXY_SYSTEM restart failed"
fi
service $PROXY_SYSTEM configtest
Why is using service command is considering legacy and the command is deprecated also configtest is deprecated too.
If you want use to test config file should be use nginx -t instead of service nginx configtest
sahsanu
September 10, 2023, 11:39pm
7
I don’t think it is because is using service nginx configtest
to test the config.
$ service nginx configtest
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Are you sure nginx -t
or service nginx configtest
doesn’t give any error?
I think I don’t explained well.
Restart never exist is just error message.
When i say services command the command is obsolete
Error come because service nginx configtest throw me an error
service nginx configtest
nginx: unrecognized service
Because previous error, v-restart-proxy yes show me an error i report here.
Service command still works but not with configtest
sahsanu
September 11, 2023, 10:37am
9
Uff, that is really weird. Did you remove manually nginx service?
Please, show the ouput of these commands:
service --status-all | grep nginx
ls -l /etc/init.d/nginx*
service --status-all | grep nginx
[ + ] nginx
[ - ] nginx-debug
ls -l /etc/init.d/nginx*
-rwxr-xr-x 1 root root 4287 Aug 15 18:48 /etc/init.d/nginx
-rwxr-xr-x 1 root root 4312 Aug 15 18:48 /etc/init.d/nginx-debug
sahsanu
September 11, 2023, 5:16pm
11
Really strange.
Running it directly shows any error?
/etc/init.d/nginx configtest
Other service commands work?
service nginx status
service nginx reload
service ssh status
sahsanu
September 11, 2023, 5:27pm
12
Also, show the output of this command:
bash -x service nginx configtest