我已经复印了样品。在Tomcat的webapps目录下,我可以访问localhost:8080。
Tomcat如何部署,需要在浏览器中打开吗?如何访问该应用程序?
我已经复印了样品。在Tomcat的webapps目录下,我可以访问localhost:8080。
Tomcat如何部署,需要在浏览器中打开吗?如何访问该应用程序?
当前回答
有两种方法:
您可以进行热部署(热部署意味着在服务器运行/启动时进行部署)。 或者您可以进行冷部署(冷部署意味着在服务器停止时进行部署)。
只需使用tomcat管理控制台进行控制台部署,或者简单地复制并粘贴应用程序到服务器tomcat_home目录的webapp文件夹中。
注意:如果您的war文件大小超过52 MB(默认配置值), 你需要在你的webapp文件夹的Manager应用程序的web.xml文件中做两个小的修改(在安装服务器时,默认由Apache tomcat提供Manager应用程序)。
Go to the web.xml of the manager application (for instance it could be under /tomcat7/webapps/manager/WEB-INF/web.xml. Increase the max-file-size and max-request-size values in web.xml file: <multipart-config> <!– 50MB max –> <max-file-size>52428800</max-file-size> <max-request-size>52428800</max-request-size> <file-size-threshold>0</file-size-threshold> </multipart-config> Increase the size by putting the values for <max-file-size> and <max-request-size> according to your requirement.
其他回答
In addition to the ways already mentioned (dropping the war-file directly into the webapps-directory), if you have the Tomcat Manager -application installed, you can deploy war-files via browser too. To get to the manager, browse to the root of the server (in your case, localhost:8080), select "Tomcat Manager" (at this point, you need to know username and password for a Tomcat-user with "manager"-role, the users are defined in tomcat-users.xml in the conf-directory of the tomcat-installation). From the opening page, scroll downwards until you see the "Deploy"-part of the page, where you can click "browse" to select a WAR file to deploy from your local machine. After you've selected the file, click deploy. After a while the manager should inform you that the application has been deployed (and if everything went well, started).
以下是来自Tomcat 7文档页面的更长的操作说明和其他说明。
应用程序名称进入tomcat部署URL的上下文中, 如。http://localhost applicationName。 如果您的应用程序名称很简单,那么它应该是http://localhost:8080/sample。
默认情况下,Port是8080,但是如果你想改变它,或者想知道tomcat运行的端口,只需到<tomcat-apache-dir>/conf/server.xml中的server.xml文件,在那里你可以找到Port和change。 如。<连接器端口="8080" redirectPort="8443" connectionTimeout="20000" protocol="HTTP/1.1"/>
如果出现任何错误,检查日志文件(例如<tomcat-apache-dir>/logs/catalina.out)
你只需要把war文件放在webapps中,然后启动你的服务器。
它将被部署。
否则,你也可以使用tomcat管理器在webfront上远程上传和部署你的战争。
如果你在linux中使用apt-get安装了tomcat7,那么将你的应用部署到/var/lib/tomcat7/webapps/
eg.
sudo service tomcat7 stop
mvn clean package
sudo cp target/DestroyTheWorldWithPeace.war /var/lib/tomcat7/webapps/
#you might also want to make sure war file has permission (`777` not just `+x`)
sudo service tomcat7 start
另外,继续跟踪tomcat日志,以便您可以验证应用程序实际上正在与tomcat和平共处。
tail -f /var/lib/tomcat7/logs/catalina.out
部署的应用程序应该出现在http://172.16.35.155:8080/manager/html中
有两种方法:
您可以进行热部署(热部署意味着在服务器运行/启动时进行部署)。 或者您可以进行冷部署(冷部署意味着在服务器停止时进行部署)。
只需使用tomcat管理控制台进行控制台部署,或者简单地复制并粘贴应用程序到服务器tomcat_home目录的webapp文件夹中。
注意:如果您的war文件大小超过52 MB(默认配置值), 你需要在你的webapp文件夹的Manager应用程序的web.xml文件中做两个小的修改(在安装服务器时,默认由Apache tomcat提供Manager应用程序)。
Go to the web.xml of the manager application (for instance it could be under /tomcat7/webapps/manager/WEB-INF/web.xml. Increase the max-file-size and max-request-size values in web.xml file: <multipart-config> <!– 50MB max –> <max-file-size>52428800</max-file-size> <max-request-size>52428800</max-request-size> <file-size-threshold>0</file-size-threshold> </multipart-config> Increase the size by putting the values for <max-file-size> and <max-request-size> according to your requirement.