Mac OS上安裝Tomcat服務器的簡單步驟
一. 下載tomcat
首先要到tomcat官網(wǎng)去下載安裝包,官網(wǎng)下載地址如下:http://tomcat.apache.org/download-70.cgi , 注意請下載飛windows版本。和windows操作系統(tǒng)不一樣,這個里面沒有令人厭煩的注冊表。
將壓縮包解壓到任意一個目錄,我這里是存放到/ProgramFile/tomcat 目錄下面
二. 修改授權
tomcat中的幾個運行服務程序都是以*.sh結尾的,在運行之前需要授權。打開終端輸入如下命令:
輸入如下命令:
sudo chmod 755 /ProgramFile/tomcat/bin/*.sh
回車出現(xiàn)要輸入密碼:請輸入本機賬戶密碼
三. 啟動tomcat服務
先使用 cd 命令進入tomcat的bin目錄,命令如下:
cd /ProgramFile/tomcat/bin/
啟動服務命令:
sudo sh startup.sh
啟動成功,會出現(xiàn)如下結果:
Using CATALINA_BASE: /ProgramFile/tomcat Using CATALINA_HOME: /ProgramFile/tomcat Using CATALINA_TMPDIR: /ProgramFile/tomcat/temp Using JRE_HOME: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Using CLASSPATH: /ProgramFile/tomcat/bin/bootstrap.jar:/ProgramFile/tomcat/bin/tomcat-juli.jar Tomcat started.
如果出現(xiàn)如上結果,說明tomcat啟動成功
四. tomcat 相關配置的修改
打開tomcat中的 /tomcat/conf/tomcat-users.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"/> --> <role rolename="manager"/> <user username="tomcat" password="root" roles="manager"/> </tomcat-users>
默認<role> 都是被注釋的,這里添加如下:
<role rolename="manager"/> <user username="tomcat" password="root" roles="manager"/>
更多配置修改,可以查看tomcat的相關資料
這個時候輸入 http://localhost:8080/ 應該就可以訪問了,做java web開發(fā)的應該很熟悉,這里不再討論
相關文章
SpringBoot整合Redis實現(xiàn)消息發(fā)布與訂閱的示例代碼
能實現(xiàn)發(fā)送與接收信息的中間介有很多,比如:RocketMQ、RabbitMQ、ActiveMQ、Kafka等,本文主要介紹了Redis的推送與訂閱功能并集成Spring Boot的實現(xiàn),感興趣的可以了解一下2022-08-08SpringCloudGateway網(wǎng)關處攔截并修改請求的操作方法
這篇文章主要介紹了SpringCloudGateway網(wǎng)關處攔截并修改請求的操作方法,本文通過示例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友參考下吧2023-12-12Java實戰(zhàn)項目練習之球館在線預約系統(tǒng)的實現(xiàn)
理論是遠遠不夠的,只有在實戰(zhàn)中才能獲得能力的提升,本篇文章手把手帶你用java+SpringBoot+maven+freemark+Mysql實現(xiàn)一個球館在線預約系統(tǒng),大家可以在過程中查缺補漏,提升水平2022-01-01springBoot Junit測試用例出現(xiàn)@Autowired不生效的解決
這篇文章主要介紹了springBoot Junit測試用例出現(xiàn)@Autowired不生效的解決,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2021-09-09