Change virtual server web port?

I have an Apache 7.2 web server currently listening on 80/443. It has a LetsEncrypt certificate.

I need to move it to a different port because it will be on a different server on the same network.

I believe I figured out how to change the ports via templates for NEW virtual servers, but how do I change the ports (both the existing https and https) for an existing web server.


Have a look at Server Templates under System Settings:

I don’t think that will work for existing Virtual Servers, will it?

No, it will only be applied to newly created virtual-servers. However, you can use Virtualmin CLI command to do it:

virtualmin modify-web --domain --port 8080 --ssl-port 4443

If you have many site hosted, you can create a small bash scrip to run it in a loop:

for dom in `virtualmin list-domains --name-only --toplevel`; do
  virtualmin modify-web --domain $dom --port 8080 --ssl-port 4443

You can get more for what modify-web can do:

virtualmin modify-web --domain name | --all-domains
                     [--mode mod_php|cgi|fcgid|fpm]
                     [--php-children number | --no-php-children]
                     [--php-version num]
                     [--php-timeout seconds | --no-php-timeout]
                     [--suexec | --no-suexec]
                     [--proxy http://... | --no-proxy]
                     [--framefwd http://... | --no-framefwd]
                     [--frametitle "title" ]
                     [--webmail | --no-webmail]
                     [--matchall | --no-matchall]
                     [--includes extension | --no-includes]
                     [--access-log log-path]
                     [--error-log log-path]
                     [--document-dir subdirectory | --fix-document-dir]
                     [--port number] [--ssl-port number]
                     [--url-port number] [--ssl-url-port number]
                     [--letsencrypt-renew months | --no-letsencrypt-renew]
                     [--add-webmin-cert | --remove-webmin-cert]