未安装nginx输入ip直接访问工程

时间:2021-01-02 11:52:09
不安装nginx情况下,输入ip直接访问指定工程方法:

在tomcat6的配置文件下(/var/lib/tomcat6/conf/server.xml找到Host部分
<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
在后面添加你所需要直接访问的工程内容,如下:
 <Context path="" docBase="/spring/client" debug="0" reloadable="true" />

 path路径为空,程序指定位置在docBase,重启tomcat即可。

<Service name="xxx">

    <Connector port="8080" protocol="HTTP/1.1" 
                maxThreads="80" minSpareThreads="80" maxSpareThreads="100" acceptCount="100"
                enableLookups="false"
               connectionTimeout="20000" 
               URIEncoding="UTF-8"
               redirectPort="8443" />
    <Engine name="xxx" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
    <Host name="localhost" debug="0" appBase="/xxx/temp/" unpackWARs="true" autoDeploy="true"  xmlValidation="false" xmlNamespaceAware="false">
	<Context path="" docBase="/xxx/" debug="0" reloadable="true" crossContext="true"></Context>
      </Host>
    </Engine>
  </Service>