Nginx shows warning when running nginx -t: nginx: [warn] protocol options redefined for 203.0.113.2

Follow

Comments

2 comments

  • Avatar
    turgut kalfaoglu (Edited )

    How about fixing the already existing hostings? (I think the above script fixes ALL of the hostings actually.)

    I manually ran the script, but it now complains about ipv6 addresses..

    nginx: [warn] protocol options redefined for [2a01:xxx:xxx:xxx::2]:443 in /etc/nginx/plesk.conf.d/vhosts/domain.com.conf:183
    (repeats for pages)

    0
    Comment actions Permalink
  • Avatar
    Rik Wijnen

    To fix IPv6 too using the workaround above, you can use this in step 2 as the code above is only working for IPv4;

    #!/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 $vhostDir/system/*/conf -type f -name "nginx.conf" | xargs -i sed -i '/http2/!s/\(listen \[[0-9a-f:]*\]: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/plesk.conf.d/webmails/ -type f -name "*.conf" | xargs -i sed -i '/http2/!s/\(listen \[[0-9a-f:]*\]:443 ssl\)/\1 http2/' {}
            find /etc/nginx -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-9a-f:]*\]:443 ssl\)/\1 http2/' {}
    else
            echo "Vhost DIR fetch failed. Exiting ..." && exit 0
    fi
    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request