简体   繁体   English

使用AWS Elastic Beanstalk时编辑应用程序路径

[英]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 &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 Unable to detect application deployment" “ aws无法检测到应用程序部署”

Here is a screenshot: 这是屏幕截图: 在此处输入图片说明

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: 我相信您将需要采取以下步骤:

  1. create a Tomcat server.xml file that sets path=myapp 创建设置path=myapp的Tomcat server.xml文件
  2. copy this file to beanstalk during its deployment phase 在部署阶段将此文件复制到beantalk

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.

相关问题 在不同路径下访问Tomcat根应用程序(在AWS / Elastic Beanstalk上) - Access Tomcat root application under different path (on AWS/Elastic Beanstalk) 使用 AWS Elastic Beanstalk 进行应用程序日志记录 - Application logging with AWS Elastic Beanstalk 在AWS Elastic Beanstalk应用程序中运行Tomcat Docker时进行端口转发 - Port forwarding in when running a Tomcat Docker in an AWS Elastic Beanstalk application 结合使用AWS Elastic Beanstalk和Java / BlazeDS / Spring应用程序 - Using AWS Elastic Beanstalk with a Java/BlazeDS/Spring application 使用 Logback 的 AWS Elastic Beanstalk 应用程序日志记录 - AWS Elastic Beanstalk Application Logging with Logback 上传到 AWS Elastic Beanstalk 时,应用程序源包不起作用 - Application source bundle doesn't work when uploaded to AWS Elastic Beanstalk AWS Elastic Beanstalk缓存? - AWS Elastic Beanstalk caching? 将Spark-Java(Gradle,Maven)应用程序部署到AWS Elastic Beanstalk - Deploy Spark-Java (Gradle, Maven) application to AWS Elastic Beanstalk Spring Boot Application无法在AWS Elastic Beanstalk中进行一次身份验证 - Spring Boot Application not authenticating once in AWS Elastic Beanstalk 将JVM参数传递给AWS Elastic Beanstalk上的Java应用程序 - Passing JVM Arguments to a Java application on AWS Elastic Beanstalk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM