Search code examples
portesxi

How can i change default port 80 and 443 in esxi host 6.7?


I m running an esxi 6.7 free.

I would like to expose my esxi to internet through my router. But i want to change the default port whose are 80 and 443.

I found many tutorials / knownledge base available for esxi 5.0 and 6.0 but none of theses are working.

In theses tutorial, there are part with firewall and reverse proxy but no matter what i do, nothings works, mostly when i restart the firewall.


Solution

  • I suppose it's already solved but for others....

    How to change port by ssh on ESXi 6.7 host video -> https://www.youtube.com/watch?v=a7kuwmLuwvU or set in router port redirecting from 443 to desired port if possible.

    edit: for the ones they prefer to read :-)

    1. enable ssh on esxi host
    2. connect via ssh or press alt + f1 on esxi host
    3. edit this file by command vi /etc/vmware/rhttpproxy/config.xml
    4. find text https by command :/https
    <!-- HTTPS port to be used by the reverse proxy -->
    <httpsPort>443</httpsPort>
    5. change port to eg. 9443 
    (press insert before editing and after finished press esc save it by :wq)
    6. reboot needed by command reboot
    7. after reboot connect to ssh and create new file changedport.xml by command 
    vi /etc/vmware/firewall/changedport.xml
    8. copy this text to console.
    <ConfigRoot>
      <service>
        <id>changedport</id>
        <rule id='0000'>
          <direction>inbound</direction>
          <protocol>tcp</protocol>
          <porttype>dst</porttype>
          <port>9443</port>
        </rule>
        <enabled>true</enabled>
        <required>false</required>
      </service>
    </ConfigRoot>
    9. save it by :wq
    10. refresh firewall rules by command esxcli network firewall refresh
    

    This is not a permanent solution. After restarting, you need to add firewall rules again and execute command esxcli network firewall refresh