No internet connection
  1. Home
  2. Technical Support

How do I change listen port of GUI for TinyPilot Pro?

By Alan Chiu @mikerotch
    2022-12-09 20:42:35.365Z

    When I was using the non-pro version of TinyPilot, I could use tinypilot_external_port: in settings.yaml to specify the port.

    I tried that with TinyPilot Pro and it doesn't seem to work.

    I added that to my settings, then ran the install script again:
    /opt/tinypilot/scripts/upgrade && sudo reboot
    and after the Voyager came back up , I can still access the GUI using port 80 and can't using the port after tinypilot_external_port

    Solved in post #2, click to view
    • 3 replies
    1. C
      Charles Hague @cghague2022-12-12 15:01:19.092Z2022-12-20 17:49:36.438Z

      Hi Alan - thanks for your great question on changing the port TinyPilot listens on!

      You are correct that you need to modify settings.yml. However, if you're already on the most recent version of TinyPilot Pro then you'll need to force the update process to run in order for the changes to be picked up.

      I've put together a short shell snippet that will do this for you. To get started, connect via SSH and run the following commands to specify the required ports:

      NEW_EXTERNAL_HTTP_PORT=80
      NEW_EXTERNAL_TLS_PORT=443
      

      Once you've done that simply run the following snippet to apply the changes:

      sudo sed --in-place '/tinypilot_external_port/d' \
          /home/tinypilot/settings.yml && \
        sudo sed --in-place '/tinypilot_external_tls_port/d' \
          /home/tinypilot/settings.yml && \
        echo "tinypilot_external_port: ${NEW_EXTERNAL_HTTP_PORT}" \
          | sudo tee --append /home/tinypilot/settings.yml && \
        echo "tinypilot_external_tls_port: ${NEW_EXTERNAL_TLS_PORT}" \
          | sudo tee --append /home/tinypilot/settings.yml && \
        sudo cp --no-clobber /opt/tinypilot/VERSION /opt/tinypilot/VERSION.bak && \
        echo "2.4.0" | sudo tee /opt/tinypilot/VERSION && \
        sudo /opt/tinypilot-privileged/update && \
        sudo mv --force /opt/tinypilot/VERSION.bak /opt/tinypilot/VERSION
      

      After the update process completes (which may take a little while) TinyPilot Pro will be listening on the new ports.

      ReplySolution
      1. M
        In reply tomikerotch:
        Alan Chiu @mikerotch
          2022-12-12 16:53:08.335Z

          Thanks, this worked. If I use the GUI to upgrade Tinypilot, do I still have to run the script you provided after the upgrade? Or will the ports stay the same until I run the commands:

          export NEW_EXTERNAL_PORT=80
          export NEW_EXTERNAL_TLS_PORT=443

          again?

          1. C
            In reply tomikerotch:

            The variables NEW_EXTERNAL_PORT and NEW_EXTERNAL_TLS_PORT are temporary and are only used when the above script is being ran. The script writes the actual changes to /home/tinypilot/settings.yml which means they will persist through updates, including those triggered from the web interface.