[英]Edit application path when using AWS Elastic Beanstalk
With local tomcat my application url is: http://ip:port/myapp but when deploying it to AWS Elastic Beanstalk the url becomes http://some_domain.com . 使用本地tomcat,我的应用程序URL为: http:// ip:port / myapp,但是在将其部署到AWS Elastic Beanstalk时,该URL为http://some_domain.com 。 I want the url to be http://some_domain.com/myapp .
我希望该网址为http://some_domain.com/myapp 。
How do I do that? 我怎么做? I found something about adding some config file to .ebextensions but I wasn't sure what exactly I should do and whether it helps at all.
我发现了一些有关向.ebextensions中添加一些配置文件的事情,但是我不确定该怎么做以及它是否有帮助。
UPDATE: 更新:
I created an .ebextensions folder and put the the following files: 我创建了一个.ebextensions文件夹,并将以下文件放入:
server.xml server.xml
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<Listener className="org.apache.catalina.core.JasperListener"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<Engine defaultHost="localhost" name="Catalina">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
<Context docBase="EizeRest" path="/EizeRest" reloadable="true" source="org.eclipse.jst.jee.server:EizeRest"/>
</Host>
</Engine>
</Service>
</Server>
server-update.config 服务器更新
container_commands:
replace-config:
command: cp .ebextensions/server.xml /etc/tomcat7/server.xml
And when deploying I'm getting the following error: 并且在部署时出现以下错误:
"aws Unable to detect application deployment" “ aws无法检测到应用程序部署”
Another update: 另一个更新:
I see in the events tab of the server the following error: cannot stat '.ebextensions/server.xml': No such file or directory 我在服务器的事件选项卡中看到以下错误:无法统计'.ebextensions / server.xml':没有这样的文件或目录
I believe you will need to take the following steps: 我相信您将需要采取以下步骤:
path=myapp
path=myapp
的Tomcat server.xml文件 Beanstalk documentation provides a relevant guide for that here: http://aws.typepad.com/aws/2012/10/customize-elastic-beanstalk-using-configuration-files.html Beanstalk文档在此处提供了相关的指南: http : //aws.typepad.com/aws/2012/10/customize-elastic-beanstalk-using-configuration-files.html
Basically the guide says you need to copy the server.xml to beanstalk by creating the following file in your application root: .ebextenstions/tomcat.config
: 基本上,该指南说,您需要通过在应用程序根目录中创建以下文件来将server.xml复制到beantalk:
.ebextenstions/tomcat.config
:
container_commands:
replace-config:
command: cp .ebextensions/server.xml /etc/tomcat7/server.xml
don't forget to commit both the server.xml
and the tomcat.config
files in the .ebextensions folder. 不要忘记同时提交
tomcat.config
文件夹中的server.xml
和tomcat.config文件。
You must place your ".ebextensions" folder at the same level as your WEB-INF folder. 您必须将“ .ebextensions”文件夹放置在与WEB-INF文件夹相同的级别。 Doing that will remove the ".ebextensions/server.xml: No such file or directory" error.
这样做将消除“ .ebextensions / server.xml:无此类文件或目录”错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.