通过SSH修改ESXI的HTTP/HTTPS端口

38,203次阅读

共计 1514 个字符,预计需要花费 4 分钟才能阅读完成。

今天接到客户反馈 ESXI 改了 WEB 端口以后无法访问。

通过 SSH 修改 ESXI 的 HTTP/HTTPS 端口

通过进一步沟通,终于明白客户的意思;

ESXI 服务器托管在封 80 443 的机房,安装好以后需要通过 SSH 改 WEB 端口。

等了两个多小时,机房才把 ESXI 给他安装好,拿到 SSH 后登录服务器;

编辑 WEB 配置文件

/etc/vmware/rhttpproxy/config.xml

vi /etc/vmware/rhttpproxy/config.xml

原始端口配置如下

<!– HTTP port to be used by the reverse proxy –>
<httpPort>80</httpPort>

<!– HTTPS port to be used by the reverse proxy –>
<httpsPort>443</httpsPort>

修改为

<!-- HTTP port to be used by the reverse proxy -->
<httpPort>1180</httpPort>

<!-- HTTPS port to be used by the reverse proxy -->
<httpsPort>1443</httpsPort>

然后再修改防火墙配置文件

/etc/vmware/firewall/service.xml

先改文件权限属性、再编辑文件

chmod 644 /etc/vmware/firewall/service.xml
chmod +t /etc/vmware/firewall/service.xml
vi /etc/vmware/firewall/service.xml

把如下内容添加到配置文件最后一个标记之前

  <service id='0088'>                   
    <id>http1180</id>                  
    <rule id='0000'>                    
      <direction>inbound</direction>    
      <protocol>tcp</protocol>          
      <porttype>dst</porttype>          
      <port>1180</port>                 
    </rule>                             
    <enabled>true</enabled>             
    <required>false</required>          
  </service>                                                     
                                        
  <service id='0089'>                   
    <id>hhtps1443</id>              
    <rule id='0000'>                    
      <direction>inbound</direction>    
      <protocol>tcp</protocol>          
      <porttype>dst</porttype>          
      <port>902</port>                  
    </rule>                             
    <rule id='0001'>                    
      <direction>inbound</direction>    
      <protocol>tcp</protocol>          
      <porttype>dst</porttype>          
      <port>1443</port>                 
    </rule>                             
    <enabled>true</enabled>             
    <required>true</required>           
  </service> 

现在需要将文件权限恢复回去

chmod 444 /etc/vmware/firewall/service.xml
chmod -t /etc/vmware/firewall/service.xml

这个时候,关键的东西来了,为了能保存住配置,防止重启被还原,咱们需要把这个配置文件打个包,放到引导记录里面,让系统能每次自动解包我们的这个修改后的配置文件。

tar -cvpzf service.tgz /etc/vmware/firewall/service.xml
BootModuleConfig.sh --add=service.tgz

如果没有报错的话,现在你可以重启然后用刚才设定的端口访问 WEB 管理页了。

从登陆服务器到重启以后验证效果,耗时 15 分钟。

正文完
 3
Blood.Cold
版权声明:本站原创文章,由 Blood.Cold 2020-03-24发表,共计1514字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。