项目发布 ip/域名映射

修改host文件,绑定域名。

vi /usr/local/tomcat/conf/server.xml

查找“</Host>”标签,并在后面添加

<Host name="210.73.209.157" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">

  <Context path="" docBase="/usr/local/tomcat/webapps/Afinitor" debug="0" reloadable="true" />

  <Alias>210.73.209.157</Alias>

  </Host>

<Host name="afinitor.novartis.com.cn" appBase="webapps"  unpackWARs="true" autoDeploy="true"  >

    <Context path="" docBase="/usr/local/tomcat/webapps/Afinitor" reloadable="true"></Context>

    <Alias>afinitor.novartis.com.cn</Alias>

</Host>

注:标红ip请替换正式ip, “afinitor.novartis.com.cn”为正式域名。

 

vi /opt/lampp/etc/extra/httpd-vhosts.conf

在文件末尾添加以下内容:

<VirtualHost *:80>

     ProxyRequests On

     ServerAdmin webmaster@dummy-host2.example.com

     DirectoryIndex index.html index.jsp

     ProxyPass / http://afinitor.novartis.com.cn:8080/

     ProxyPassReverse / http://afinitor.novartis.com.cn:8080/

     ServerName afinitor.novartis.com.cn

     ServerAlias afinitor.novartis.com.cn

</VirtualHost>

<VirtualHost *:80>

     ProxyRequests On

     ServerAdmin webmaster@dummy-host2.example.com

     DirectoryIndex index.html index.jsp

     ProxyPass / http://210.73.209.157:8080/

     ProxyPassReverse / http://210.73.209.157:8080/

     ServerName 210.73.209.157

     ServerAlias 210.73.209.157

</VirtualHost>

注:标红ip请替换正式ip, “afinitor.novartis.com.cn”为正式域名。

 

注:上面代码的结果是,在tomcat/webapps下面发布名称为 Afinitor 的项目,浏览器访问时地址栏只需输入 http://ip  即可,无需端口号和项目名。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值