VMmanager Knowledge Base

How to change the platform's web interface ports?

This article contains instructions on how to change the default ports for HTTP (80/TCP) and HTTPS (443/TCP) access to the platform.

  1. Connect to the server with the platform via SSH. For more information about connecting via SSH, see Workstation setup.
  2. Check the current port settings in /opt/ispsystem/vm/docker-compose.yamlpublished parameters for the input container:
    cat /opt/ispsystem/vm/docker-compose.yaml
    Example output
      input:
        container_name: input
        image: docker-registry.ispsystem.com/team/vm/input/alma:2.0.9
        ...
        ports:
        - published: 80
          target: 80
        - published: 443
          target: 443
        ...
  3. Change the port values: 
    sed -i 's%- published: \"old_port\"%- published: \"new_port\"%g' /opt/ispsystem/vm/docker-compose.yaml
    Comments to the command
    Example for changing the port from 80/TCP to 8080/TCP
    sed -i 's%- published: \"80\"%- published: \"8080\"%g' /opt/ispsystem/vm/docker-compose.yaml
  4. Check that the port values have been changed: 
    cat /opt/ispsystem/vm/docker-compose.yaml
    After the change, the settings should look like this: 
      input:
        container_name: input
        image: docker-registry.ispsystem.com/team/vm/input/alma:2.0.9
        ...
        ports:
        - published: <новый HTTP port>
          target: 80
        - published: <новый HTTPS port>
          target: 443
        ...
  5. Recreate the input container: 
    docker stop vm_input_1
    docker rm -f vm_input_1
    vm start
  6. If you have only changed the HTTP port settings, disable the automatic redirect from HTTP to HTTPS in the web server settings:
    These changes will be reset the next time the input container is restarted. For example, when the platform is updated or reloaded.
    1. Enter the input container: 
      docker exec -it input bash
    2. Change the web server configuration: 
      sed 's%return 301 https://$host$request_uri;%return 301 https://$host:4433$request_uri;%g' /etc/nginx/templates/secure.conf.ctmpl
    3. Stop the web server:
      /etc/init.d/nginx stop
    4. Back up the secure.conf configuration file:
      mv /etc/nginx/conf.d/secure.conf /etc/nginx/conf.d/secure.conf.bak
    5. Start the web server:
      /etc/init.d/nginx start
    6. Exit the container: 
      exit
  7. Check if the platform's web interface opens using the new ports.