Symptoms
-
The following warning shows up when running
nginx -t
via CLI:# nginx -t
nginx: [warn] protocol options redefined for 203.0.113.2:443 in /etc/nginx/plesk.conf.d/vhosts/example.com.conf:7
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful -
Server preference http2 is enabled:
# plesk bin http2_pref --status
Enabled -
Preferred domain is set to
example.com
in
Domains > example.com > Hosting & DNS > Hosting -
Running command
plesk bin http2_pref --enable
may fix the warning temporarily, but will show up again.
Cause
This was confirmed as a bug with ID
PPPM-14042
.
Since nginx 1.24 it is mandatory to specify http2 in every listen directive which does include the ssl option if http2 is enabled.
Resolution
Use Event Handlers to update nginx configuration files:
-
Connect to the server via
SSH -
Create and
Edit file
/root/update_nginx.sh
that will be used by the Event Handler:#!/bin/bash
vhostDir=$(grep VHOST /etc/psa/psa.conf | awk {'print $2'})
if [ ! -z "$vhostDir" ] ; then
sleep 15
find $vhostDir/system/*/conf -type f -name "nginx.conf" | xargs -i sed -i '/http2/!s/(listen [0-9.]*:443 ssl)/1 http2/' {}
find /etc/nginx/plesk.conf.d/webmails/ -type f -name "*.conf" | xargs -i sed -i '/http2/!s/(listen [0-9.]*:443 ssl)/1 http2/' {}
find /etc/nginx -type f -name "*.conf" | xargs -i sed -i '/http2/!s/(listen [0-9.]*:443 ssl)/1 http2/' {}
else
echo "Vhost DIR fetch failed. Exiting ..." && exit 0
fi -
Set executable permissions to the script:
# chmod +x /root/update_nginx.sh
-
Create Event Handler by going to
Tools & Settings > Event Manager > Add Event Handler
and add the following details:- Event: Physical hosting created
- Priority: 50
- User: root
- Command: /root/update_nginx.sh
-
Repeate step 5 for Event: Physical hosting updated