Mac下搭建Tomcat环境

1.到apache官网下载Tomcat安装文件:http://tomcat.apache.org/

点击Download中的版本,我选择的是7.0,下载Core中的zip包或tar.gz包


2.解压安装包,将解压后的apache-tomcat-7.0.47移动到你的理想位置。


3.打开终端,输入命令:sudo sh startup.sh所在的完整路径,注意startup.sh的后缀sh不能少。

sudo sh /Users/apple/apache-tomcat-7.0.47/bin/startup.sh
启动Tomcat成功。

停止Tomcat的方法,输入以下命令:sudo sh shutdown.sh文件路径

sudo sh /Users/apple/apache-tomcat-7.0.47/bin/shutdonw.sh

4.配置Tomcat的端口号和管理用户。

打开server.xml,找到以下选项并配置:

<Connector port="9000" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
打开tomcat-user.xml,编辑以下选项:

<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
 -->
<user username="admin" password="admin" roles="admin,manager,role1,tomcat,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" />
</tomcat-users>

此时可以直接使用用户名和密码均为admin的账号登陆管理。


5.成功标志:打开浏览器,输入http://localhost:端口号/(注意startup不能停),再登陆看看。如果成功,那就没问题了。


这里我没遇到网上所说的一些文件权限问题,所以感觉Mac配置Tomcat比Windows方便太多了。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值