1.启动regist和gateway的jar命令
//后台启动注册中心jar包,远程连接断开之后依旧会保持启动状态,不会停服务
nohup java -jar register-0.0.1-SNAPSHOT.jar >registerLog.text 2>&1 &
//后台启动gateway
nohup java -jar gateway-0.0.1-SNAPSHOT.jar >gatewayLog.text 2>&1 &
2.将springboot项目达成war包部署外部tomcat,在gateway中访问的路径需要加上webapp中的项目名,否则访问不到,可以将外部tomcat的配置更改,更改conf下面的server.xml
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!--加上context path,path为空,后面的docbase是项目的路径-->
<Context path="" docBase="/data/server/witch-admin/webapps/witch-admin"> </Context>
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
这样就可以直接不加上项目名访问该服务了,比如gateway端口是8888,eureka中注册的服务名是admin,方法是/admin/login
那么可以直接访问http://IP:8888/admin/admin/login