Disable IPv6 for vovnginxd


When does this page apply?

The steps described on this page only apply to projects where nginx is used as a webprovider. For versions prior to 2021, there is no other webprovider than nginx. In versions 2021 and above you can check this via

$ vovservermgr config | grep webprovider
      webprovider                     "nginx"

If the internal webprovider is in use, the following does NOT apply.

Diagnostics

Disabling IPv6 for vovnginxd is needed if you're seeing errors like the following in the $swd/vovnginxd/logs/error.log:

2023/04/13 10:16:36 [emerg] 7258#0: socket() [::]:5557 failed (97: Address family not supported by protocol)

This happens if the system running vovnginxd has IPv6 support disabled.

Solution

  1. Copy the $VOVDIR/etc/config/vovnginxd/nginx.conf.template file to $swd/vovnginxd/conf/nginx.conf.template.
  2. Edit the $swd/vovnginxd/conf/nginx.conf.template file and change the line

    listen [::]:@WEBPORT@ @SSLFLAG@ ipv6only=off;

    to

    listen @WEBPORT@ @SSLFLAG@;
  3. Restart the webprovider

    # Setting the webport to 0 will stop the webprovider
    $ vovservermgr config webport 0
    vovservermgr 04/13/2023 10:24:10: message: Parameter webport was changed from 5557 to 0
     
    # Wait for a couple of seconds
     
    # Setting the webport back to the original value (5557 in this case) will start the webprovider again
    $ vovservermgr config webport 5557
    vovservermgr 04/13/2023 10:24:15: message: Parameter webport was changed from 0 to 5557
  4. Check if the change was successful
    1. The $swd/vovnginxd/conf/nginx.conf file should now contain

      listen 5557 ;

      instead of

      listen [::]:5557  ipv6only=off;

      or (with SSL enabled)

      listen 5557 ssl;

      instead of

      listen [::]:5557 ssl ipv6only=off;
    2. The error in the $swd/vovnginxd/logs/error.log should not reappear
    3. The port should be successfully bound (IPv4 only)

      $ netstat -tlpn | grep 5557
      tcp        0      0 0.0.0.0:5557            0.0.0.0:*               LISTEN      22491/nginx: master
    4. Access to the webUI should work

General guidelines

Temporary Changes

To test different settings for vovnginxd it is possible to manually edit the $swd/vovnginxd/conf/nginx.conf file.

To apply the changes, run

$ vovdaemonmgr reread vovnginxd
vovnginxd                REREADING ...

or

$ vovdaemonmgr restart vovnginxd
vovdaemonmgr 04/13/2023 10:47:54: message: Stopping vovnginxd...
vovdaemonmgr 04/13/2023 10:47:55: message: Restarting vovnginxd...

Please note: Direct changes to $swd/vovnginxd/conf/nginx.conf won't survive a webprovider restart. A webprovider restart is done by changing the webport, SSL setting, or (re)starting vovserver. Refer to the documentation (http://<host>:<port>/doc/html/accel/topics/shared/server_configuration_web.htm) for further info about this topic.

Permanent Changes

For changes to persist after webprovider restarts, it is necessary to make use of the nginx.conf.template file. Technically, a webprovider restart will overwrite/recreate the $swd/vovnginxd/conf/nginx.conf file based on the first nginx.conf.template file being found ($swd/vovnginxd/conf/nginx.conf.template > $VOVDIR/local/config/vovnginxd/nginx.conf.template > $VOVDIR/etc/config/vovnginxd/nginx.conf.template).

As in the Solution steps above, start with a copy of the installation-default $VOVDIR/etc/config/vovnginxd/nginx.conf.template file to $swd/vovnginxd/conf/nginx.conf.template and then make your changes in the instance-specific $swd/vovnginxd/conf/nginx.conf.template file.

To apply the changes (recreate/overwrite the $swd/vovnginxd/conf/nginx.conf file), run

# Setting the webport to 0 will stop the webprovider
$ vovservermgr config webport 0
vovservermgr 04/13/2023 10:24:10: message: Parameter webport was changed from 5557 to 0
 
# Wait for a couple of seconds
 
# Setting the webport back to the original value (5557 in this case) will start the webprovider again
$ vovservermgr config webport 5557
vovservermgr 04/13/2023 10:24:15: message: Parameter webport was changed from 0 to 5557

Refer to the documentation (http://<host>:<port>/doc/html/accel/topics/shared/server_configuration_web.htm) for further info about this topic.