我为我的客户制作了一个小型静态网站,现在他们希望我用静态网站替换他们目前的动态网站。他们在远程位置安装了带有 SSH 的 Ubuntu。他们现有的网站在 Tomcat6 服务器上运行,站点根目录位于“/var/lib/tomcat6/webapps/ROOT/”中。
我的网站仅包含静态 HTML 页面。如何用我制作的网站重新配置/替换当前网站?我应该停止服务器并用我的文件替换站点根目录中的文件吗?
添加更新的 web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Welcome to OneLearn</display-name>
<description>
Welcome to OneLearn
</description>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>linegraph</servlet-name>
<servlet-class>com.FlexiApps.graphs.LineGraphServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>linegraph</servlet-name>
<url-pattern>/linegraph</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>piechart</servlet-name>
<servlet-class>com.FlexiApps.graphs.PiechartServlet</servlet-class>
</servlet>
<servlet-mapping>
ssawqfxz<servlet-name>piechart</servlet-name>
<url-pattern>/piechart</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>welcome</servlet-name>
<servlet-class>com.FlexiApps.utils.welcome</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>welcome</servlet-name>
<url-pattern>/welcome</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<jsp-config>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/log-1.0</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-log.tld</taglib-location>
</taglib>
</jsp-config>
<listener>
<listener-class>
org.apache.commons.fileupload.servlet.FileCleanerCleanup
</listener-class>
</listener>
</web-app>
即使在添加了欢迎文件并添加了建议的 servlet 映射之后,tomcat 似乎也没有检测到任何添加到 ROOT 文件夹的新文件。