pom.xml文件中如何配置tomcat,使我这个服务只能被一个固定ip访问

<plugin>

            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <uriEncoding>UTF-8</uriEncoding>
                <port>9090</port>
                <path>/test</path>
            </configuration>
        </plugin>
阅读 3.9k
3 个回答

这个东西应该从服务器上直接限制,为什么要在tomcat里面做呢

固定的ip就是你机器的所在的ip

你这个思路不对啊,你pom里的这个配置是配置的maven的插件啊,
你难道要在你们服务器上执行 maven tomcat:run? 你们的服务器应该不会安装maven吧?

你需要调整的是服务器上 你们运行的那个tomcat的server.xml文件,

<Engine>里面新添加一个<host>,像这样:

<Host name="xxx.com" appBase="/var/www/demo"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false"></Host>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题