使用AWS Elastic Beanstalk时编辑应用程序路径 [英] Edit application path when using AWS Elastic Beanstalk

查看:106
本文介绍了使用AWS Elastic Beanstalk时编辑应用程序路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用本地tomcat,我的应用程序网址为: http://ip:port/myapp 但是在将其部署到AWS Elastic Beanstalk时,URL变为 http://some_domain.com .我希望该网址为 http://some_domain.com/myapp .

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. I want the url to be http://some_domain.com/myapp.

我该怎么做?我发现了一些有关向.ebextensions中添加一些配置文件的事情,但是我不确定该怎么做以及它是否有帮助.

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文件夹,并放置了以下文件:

I created an .ebextensions folder and put the the following files:

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 &quot;%r&quot; %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无法检测到应用程序部署"

"aws Unable to detect application deployment"

这是屏幕截图:

另一个更新:

我在服务器的事件标签中看到以下错误:无法统计'.ebextensions/server.xml':没有这样的文件或目录

I see in the events tab of the server the following error: cannot stat '.ebextensions/server.xml': No such file or directory

推荐答案

您必须将".ebextensions"文件夹放置在与WEB-INF文件夹相同的级别.这样做将消除".ebextensions/server.xml:无此类文件或目录"错误.

You must place your ".ebextensions" folder at the same level as your WEB-INF folder. Doing that will remove the ".ebextensions/server.xml: No such file or directory" error.

这篇关于使用AWS Elastic Beanstalk时编辑应用程序路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆