Change Tomcat Address on my localhost

前端 未结 3 369
不思量自难忘°
不思量自难忘° 2021-02-03 11:51

On my Tomcat, I have an HTML page.

I need to type the following address to make it run:

http://127.0.0.1:8080/BiddingSystem/BiddingSystem.html

but I want

相关标签:
3条回答
  • 2021-02-03 11:54

    You can configure the host properties in Tomcat's server.xml, and can make an alias to the default localhost host:

    <Host name="localhost" appBase="webapps" unpackWARs="true" 
                autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
        <Alias>www.moribiz</Alias>
    </Host>
    

    For more information, see Tomcat's configuration manual.

    0 讨论(0)
  • 2021-02-03 11:54

    Have a look at item 4 of O'Reilly's Tomcat tips:

    <Server port="8005" shutdown="SHUTDOWN" debug="0">
        <Service name="Tomcat-Standalone">
            <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                    port="8080" minProcessors="5" maxProcessors="75"
                    enableLookups="true" redirectPort="8443"/>
            <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                    port="8443" minProcessors="5" maxProcessors="75"
                    acceptCount="10" debug="0" scheme="https" secure="true"/>
            <Factory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
                    clientAuth="false" protocol="TLS" />
            </Connector>
            <Engine name="Standalone" defaultHost="localhost" debug="0">
            <!-- This Host is the default Host -->
            <Host name="localhost" debug="0" appBase="webapps"
                unpackWARs="true" autoDeploy="true">
                <Context path="" docBase="ROOT" debug="0"/>
                <Context path="/orders" docBase="/home/ian/orders" debug="0"
                            reloadable="true" crossContext="true">
                </Context>
            </Host>
    
            <!-- This Host is the first "Virtual Host": www.example.com -->
            <Host name="www.example.com" appBase="/home/example/webapp">
                <Context path="" docBase="."/>
            </Host>
    
            </Engine>
        </Service>
    </Server>
    

    The relevant part is where the virtual host is defined (in the last <Host> tag).

    0 讨论(0)
  • 2021-02-03 11:59

    I have Eclipse EE and Tomcat7, and I need to run my servlets not at localhost:8080, but on a pretty domain :)

    I have made it this way:

    1. In file %windows%\system32\drivers\etc\hosts add:

      127.0.0.10 tomcat
      
    2. In file %workspace%\Servers\Tomcat 7 at localhost-config\Server.xml

        <Connector port="80" address="127.0.0.10" connectionTimeout="20000"
                   protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8" />
        <Engine defaultHost="tomcat" name="Catalina">
            <Host name="tomcat" appBase="webapps" autoDeploy="true" unpackWARs="true">
            ...
            </Host>
        </Engine>
    

    Now my Apache Tomcat works fine (I hope) at http://tomcat/ and at same time my Apache2+PHP works at http://localhost/.

    0 讨论(0)
提交回复
热议问题