??xml version="1.0" encoding="utf-8" standalone="yes"?> 一、请问在win2K命o提示W下怎样更改mysql的root理员密码? >mysql -u root -p 通过q种Ҏ可以直接修改密码了。至于在CMD下能否登陆MySQLQ就要在Windows环境变量PATH中添?#8220;C:\Program Files\MySQL\MySQL Server 5.0\bin;”Q请改ؓ你自q安装路径Q了?/p>
二、MYSQL 修改root密码命o cmd下切换到 mysql 安装目录 注意每个命o后都要加上一个分?";" 重v mysql . mysql -uroot -p新密?/p>
忘记mysql 的root 密码Q?
先确认已l杀掉mysqld q程了,然后执行q个
/usr/bin/mysqld --skip-grant-tables &
再这L?
mysql -h 192.168.1.2 -u root
q里192.168.1.2Z的机器ip地址,如果在本机可使用127.0.0.1
执行完上边的后执行:
use mysql;
update user set password =password('yourpass') where user='root'
q样您的root密码׃改ok了?br />
Enter password: ******
mysql> use mysql;
mysql> update user set password=password('new_password') where user='root';
?br />
d:/mysql/bin
前提Qmysql用户root密码为空.
输入 mysql -u root mysql
mysql> 状态下输入 update user set password=password('新密?) where user='root';
回显
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> 状态下输入 FLUSH PRIVILEGES;
回显
Query OK, 0 rows affected (0.00 sec)
mysql> 状态下输入 quit
退?sql
mysql 才开始执行该行命?br />
而第二个指o会让已蝲入记忆体?mysql pȝ资料库更?/p>
在更?root 密码後,日後要与 MySQL q线的方法ؓQ?/p>
先确认已l杀掉mysqld q程了,然后执行q个
/usr/bin/safe_mysqld --skip-grant-tables &
再这L?
mysql -h 192.168.1.2 -u root
上边?92.168.1.2 是cloud 的mysqld q行机器Q你换成自己的,q样d?
去,可以修改密码了?
修改密码
1.mysql -h hostname –u root 命od到mysqld server 用grant 命o改变口o:
Grant all on *.* to root indentified by "111111"
2. mysqladmin -u 用户?p 旧密码password 新密?
?Q给root 加个密码ab12。首先在DOS 下进入目录mysqlbinQ然后键?
以下命o
mysqladmin -uroot password ab12
注:因ؓ开始时root 没有密码Q所?p 旧密码一就可以省略了?
2、例2Q再root 的密码改为djg345?
mysqladmin –u root -pab12 password djg345 (注意-p 不要和后面的密码?
开写,要写在一?
3.
use mysql; update user set password =password('yourpass') where user='r
oot'
4. 载入权限表: `mysqladmin -h hostname flush-privileges' Q或者
用SQL 命o`FLUSH PRIVILEGES'。(当然Q在q里Q你也可以重启mysqld。)
mysql 的徏库,d数据ҎQ?
mysqi –u root
mysql>create database ttt;
mysql>source 1.txt
mysql>load data local infile "2.txt" into table board;
1.txt 内容:
CREATE TABLE board (
boardid int(11) NOT NULL auto_increment,
boardname char(255),
PRIMARY KEY (boardid)
);
2.txt 内容:
1 lk(Tab 键分开)
2 lklk
3 lklklk
导出database:
#mysqldump –opt ttt –uroot –p111111 > 111.sql
导入database
1. #mysql –u root –p111111 ttt < 111.sql
2. mysql>source 111.sql;
导出的多个databaseQ?mysqldump –-databases ttt1 ttt2 ttt3 –uroot –p111111
> 111.sql
导出所有databaseQ?mysqldump –-all-databases –uroot –p111111 > 111.sql
q且我在览器中输入http://localhost:8080/web可以讉K到这个web
如果我没有设|虚拟目录的话我惌q行q个web必须要把q个文g复制到webapps下,但是现在׃需要我不能把它复制到这个目录下Q所以我要设|虚拟目录?br />
首先我要打开conf/server.xml文g然后扑ֈ<host q个标签Q在里边加入Q?br />
<context path="/web" docbase="c:\myweb" reloadable="true">便可以了?br />
下面来说一上它的几个参C表的意思:
path:是你在地址栏中输入的web
docbase:是你的实际目录c:\myweb
reloadable:是让你的web 是否能够重加?
当们讉Kb.jsp的时候就可以在浏览器中输入:http://localhost:8080/web/image/b.jsp
如果在a.jsp中要做链接可以:
<a href="image/b.jsp">
<Connector port="8080"
maxThreads="150"
minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false"
redirectPort="8443"
acceptCount="100"
debug="0"
connectionTimeout="20000"
disableUploadTimeout="true" />
把它复制一?然后再其一_脓Q修?port
<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.
define subcomponents such as "Valves" or "Loggers" at this level.
-->
shutdown="SHUTDOWN" //要监听的命o
debug="0">
<!-- Comment these entries out to disable JMX MBeans support -->
<!-- You may also configure custom components (e.g. Valves/Realms) by
including your own mbean-descriptor file(s), and setting the
"descriptors" attribute to point to a ';' seperated list of paths
(in the ClassLoader sense) of files to add to the default list.
e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"
-->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<Service name="Catalina">
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.
You can also enable an SSL HTTP/1.1 Connector on port 8443 by
following the instructions below and uncommenting the second Connector
entry. SSL support requires the following steps (see the SSL Config
HOWTO in the Tomcat 5 documentation bundle for more detailed
instructions):
* If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and
the keystore itself.
request.getRemoteHost(). This can have an adverse impact on
performance, so you can disable it by setting the
"enableLookups" attribute to "false". When DNS lookups are disabled,
request.getRemoteHost() will return the String version of the
IP address of the remote client.
-->
during installation -->
<Connector port="8080"
maxThreads="150"
minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false"
redirectPort="8443"
acceptCount="100"
debug="0"
connectionTimeout="20000"
disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->
<!-- Note : To use gzip compression you could set the following properties :
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->
<!--
<Connector port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" debug="0" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<Connector port="8009"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3" />
<!-- See proxy documentation for more information about using this. -->
<!--
<Connector port="8082"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false"
acceptCount="100" debug="0" connectionTimeout="20000"
proxyPort="80" disableUploadTimeout="true" />
-->
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). -->
<Engine name="Standalone" defaultHost="localhost" debug="0" jvmRoute="jvm1">
-->
<!-- Define the top level container in our container hierarchy -->
<Engine name="Catalina"
defaultHost="localhost" //~省的服务器地址
debug="0">
the request headers and cookies that were received, and the response
headers and cookies that were sent, for all requests received by
this instance of Tomcat. If you care only about requests to a
particular virtual host, or a particular application, nest this
element inside the corresponding <Host> or <Context> entry instead.
containers, check out the "RequestDumperFilter" Filter in the
example application (the source for this filter may be found in
"$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
element to enable it. -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>
need to go back quickly -->
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
stored in a database and accessed via JDBC -->
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/authority"
connectionName="test" connectionPassword="test"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
connectionName="scott" connectionPassword="tiger"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:CATALINA"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" //服务器的地址
debug="0"
appBase="webapps" //服务器web的存攑֜址
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
By defining this element, means that every manager will be changed.
So when running a cluster, only make sure that you have webapps in there
that need to be clustered and remove the other ones.
A cluster has the following parameters:
in case of multiple ethernet cards.
auto means that address becomes
InetAddress.getLocalHost().getHostAddress()
has a wakup bug in java.nio. Set to 0 for no timeout
false means to replicate the session after each request.
false means that replication would work for the following piece of code:
<%
HashMap map = (HashMap)session.getAttribute("map");
map.put("key","value");
%>
replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
* Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
* Synchronous means that the thread that executes the request, is also the
thread the replicates the data to the other nodes, and will not return until all
nodes have received the information.
* Asynchronous means that there is a specific 'sender' thread for each cluster node,
so the request thread will queue the replication request into a "smart" queue,
and then return to the client.
The "smart" queue is a queue where when a session is added to the queue, and the same session
already exists in the queue from a previous request, that session will be replaced
in the queue instead of replicating two requests. This almost never happens, unless there is a
large network delay.
-->
<!--
When configuring for clustering, you also add in a valve to catch all the requests
coming in, at the end of the request, the session may or may not be replicated.
A session is replicated if and only if all the conditions are met:
1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
2. a session exists (has been created)
3. the request is not trapped by the "filter" attribute
hence we don't replicate the session after the end of this request.
The filter is negative, ie, anything you put in the filter, you mean to filter out,
ie, no replication will be done on requests that match one of the filters.
The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
ending with .gif and .js are intercepted.
-->
<!--
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true">
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"/>
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
</Cluster>
-->
individually. Uncomment the following entry if you would like
a user to be authenticated the first time they encounter a
resource protected by a security constraint, and then have that
user identity maintained across *all* web applications contained
in this virtual host. -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn"
debug="0"/>
-->
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
-->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
default (when using FileLogger), log files are created in the "logs"
directory relative to $CATALINA_HOME. If you wish, you can specify
a different directory with the "directory" attribute. Specify either a
relative (to $CATALINA_HOME) or absolute path to the desired
directory.-->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<Service name="Tomcat-Standalone">
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="20000"
useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
<Engine name="Standalone" defaultHost="localhost" debug="0">
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
<Context path="/gdqy" reloadable="true" docBase="D:/gdqy/ept" debug="0"
crossContext="true"/>
</Host>
</Engine>
</Service>
</Server>
1?/span>server portQ指定一个端口,q个端口负责监听关闭tomcat的请?/span>
2?/span>shut downQ指定向端口发送的命o字符?/span>
3?/span>service nameQ指?/span>service的名?/span>
4?/span>ConnectorQ?/span>(表示客户端和service之间的连?/span>)
port 指定服务器端要创建的端口Pq在q个断口监听来自客户端的h
minProcessorsQ服务器启动时创建的处理h的线E数
maxProcessorsQ最大可以创建的处理h的线E数
enableLookupsQ如果ؓtrueQ则可以通过调用request.getRemoteHost()q行DNS查询来得到远E客L的实际主机名Q若?/span>false则不q行DNS查询Q而是q回?/span>ip地址
redirectPortQ指定服务器正在处理httph时收C一?/span>SSL传输h后重定向的端口号
acceptCount 指定当所有可以用的处理h的线E数都被使用Ӟ可以攑ֈ处理队列中的h敎ͼ过q个数的h不予处?/span>
connectionTimeout 指定时的时间数(以毫Uؓ单位)
5?/span>EngineQ?/span>(表示指定service中的h处理机,接收和处理来?/span>Connector的请?/span>)
defaultHostQ指定缺省的处理h的主机名Q它臛_与其中的一?/span>host元素?/span>name属性值是一L
6?/span>ContextQ?/span>(表示一?/span>web应用E序Q通常?/span>WAR文gQ关?/span>WAR的具体信息见servlet规范) docBase 应用E序的\径或者是WAR文g存放的\?/span>
pathQ表C此web应用E序?/span>url的前~Q这栯求的url?/span>http://localhost:8080/path/****
reloadableQ这个属性非帔R要,如果?/span>trueQ则tomcat会自动检应用程序的/WEB-INF/lib ?/span>/WEB-INF/classes目录的变化,自动装蝲新的应用E序Q我们可以在不重?/span>tomcat的情况下改变应用E序
7?/span>hostQ?/span>(表示一个虚拟主?/span>)
nameQ指定主机名
appBaseQ应用程序基本目录,卛_攑ֺ用程序的目录
unpackWARsQ如果ؓtrueQ则tomcat会自动将WAR文g解压Q否则不解压Q直接从WAR文g中运行应用程?/span>
8?/span>LoggerQ?/span>(表示日志Q调试和错误信息)
className 指定logger使用的类名,此类必须实现org.apache.catalina.Logger 接口
prefixQ指?/span>log文g的前~
suffixQ指?/span>log文g的后~
timestampQ如果ؓtrueQ则log文g名中要加入时_如下?/span>:localhost_log.
9?/span>RealmQ?/span>(表示存放用户名,密码?/span>role的数据库)
classNameQ指?/span>Realm使用的类名,此类必须实现org.apache.catalina.Realm接口
10?/span>ValveQ?/span>(功能?/span>Logger差不多,?/span>prefix?/span>suffix属性解释和Logger 中的一?/span>)
classNameQ指?/span>Valve使用的类名,如用org.apache.catalina.valves.AccessLogValvecd以记录应用程序的讉K信息
11?/span>directoryQ指?/span>log文g存放的位|?/span>
pattern 有两个|common方式记录q程L名或ip地址Q用户名Q日期,W一行请求的字符ԌHTTP响应代码Q发送的字节数?/span>combined方式?/span>common方式记录的值更多?/span>
另附tomcat5中server.xml配置
<!-- Example Server Configuration File -->
<!-- Tomcat服务器配|示例文?-->
<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->
<!-- 注意Q这些组件的构成是根据相互之间的父子关系q行嵌套的?->
<!-- A "Server" is a singleton element that represents the entire JVM,
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.
Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<!-- 一?#8220;Server”是一个提供完整的JVM的独立组Ӟ它可以包含一个或多个
“Service”实例。服务器在指定的端口上监听shutdown命o?br />
注意Q一?#8220;Server”自n不是一?#8220;Container”Q容器)Q因此在q里?br />
不可以定义诸?#8220;Valves”或?#8220;Loggers”子组?br />
-->
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<!-- Comment these entries out to disable JMX MBeans support -->
<!-- q些指olg关闭JMX MBeans支持 -->
<!-- You may also configure custom components (e.g. Valves/Realms) by
including your own mbean-descriptor file(s), and setting the
"descriptors" attribute to point to a ';' seperated list of paths
(in the ClassLoader sense) of files to add to the default list.
e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"
-->
<!-- 你也可以通过包含你自qmbean描述文g配置自定义的lgQ然后设|?br />
“descriptors”属性ؓ?#8220;Q?#8221;为分隔的文g名列表严它d到默认列?br />
中,例如Qdescriptors="/com/myfirm/mypackage/mbean-descriptor.xml"?br />
-->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
<!-- Global JNDI resources -->
<!-- 全局JNDI资源 -->
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<!-- ZCZ目的的测试入?-->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<!-- 可编辑的Q用来通过UserDatabaseRealm认证用户的用h据库 -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.
Note: A "Service" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<!-- 一?#8220;Service”是一个或多个q一个单?#8220;Container”(容器)?#8220;Connectors”
l合Q因此,应用E序在容器中可见Q。通常Q这个容器是一?#8220;Engine”
Q引擎)Q但q不是必ȝ?br />
注意Q一?#8220;Service”自n不是一个容器,因此Q在q个U别上你不可定义
诸如“Valves”?#8220;Loggers”子组件?br />
-->
Qrole name="admin"/Q?/td> |
Quser name="admin" password="deep_dark_secret" roles="admin"/Q?/td> |
CATALINA_BASE/webapps/manager.xml ?/td> |
Qrole name=”manager”Q?/td> |
Quser name="manager" password="deep_dark_secret" roles="manager"/Q?/td> |
Q?-- Context fragment for deploying MyWebApp.war --Q? QContext path="/demo" docBase="webapps/MyWebApp.war" debug="0" privileged="true"Q? QRealm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/Q? Q?ContextQ?/td> |
QServer port="8005" shutdown="SHUTDOWN" debug="0"Q? QService name="Tomcat-Standalone"Q? QConnector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443"/Q? QConnector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8443" minProcessors="5" maxProcessors="75" acceptCount="10" debug="0" scheme="https" secure="true"/Q? QFactory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory" clientAuth="false" protocol="TLS" /Q? Q?ConnectorQ? QEngine name="Standalone" defaultHost="localhost" debug="0"Q? Q?-- This Host is the default Host --Q? QHost name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true"Q? QContext path="" docBase="ROOT" debug="0"/Q? QContext path="/orders" docBase="/home/ian/orders" debug="0" reloadable="true" crossContext="true"Q? Q?ContextQ? Q?HostQ? Q?-- This Host is the first "Virtual Host": http://www.example.com/ --Q? QHost name="www.example.com" appBase="/home/example/webapp"Q? QContext path="" docBase="."/Q? Q?HostQ? Q?EngineQ? Q?ServiceQ? Q?ServerQ?/td> |
Q?-- Define the Members-only area, by defining a "Security Constraint" on this Application, and mapping it to the subdirectory (URL) that we want to restrict. --Q? Qsecurity-constraintQ? Qweb-resource-collectionQ? Qweb-resource-nameQ? Entire Application Q?web-resource-nameQ? Qurl-patternQ?members/*Q?url-patternQ? Q?web-resource-collectionQ? Qauth-constraintQ? Qrole-nameQmemberQ?role-nameQ? Q?auth-constraintQ? Q?security-constraintQ? Q?-- Define the Login Configuration for this Application --Q? Qlogin-configQ? Qauth-methodQBASICQ?auth-methodQ? Qrealm-nameQMy Club Members-only AreaQ?realm-nameQ? Q?login-configQ?/td> |
QValve className="org.apache.catalina.authenticator.SingleSignOn" debug="0"/Q?/td> |
http://www.cs.myuniversity.edu/~username http://members.mybigisp.com/~username |
QListener className="org.apache.catalina.startup.UserConfig" directoryName="public_html" userClass="org.apache.catalina.startup.PasswdUserDatabase"/Q?/td> |
QListener className="org.apache.catalina.startup.UserConfig" directoryName="public_html" homeBase="/home" userClass="org.apache.catalina.startup.HomesUserDatabase"/Q?/td> |
QservletQ? Qservlet-nameQjspQ?servlet-nameQ? Qservlet-classQ? org.apache.jasper.servlet.JspServlet Q?servlet-classQ? Qinit-paramQ? Qparam-nameQlogVerbosityLevelQ?param-nameQ? Qparam-valueQWARNINGQ?param-valueQ? Q?init-paramQ? Qinit-paramQ? Qparam-nameQcompilerQ?param-nameQ? Qparam-valueQjikesQ?param-valueQ? Q?init-paramQ? Qload-on-startupQ?Q?load-on-startupQ? Q?servletQ?/td> |
QContext path="/path/to/secret_files" ...Q? QValve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1" deny=""/Q? Q?ContextQ?/td> |
Qrole name="admin"/Q?/td> |
Quser name="admin" password="deep_dark_secret" roles="admin"/Q?/td> |
CATALINA_BASE/webapps/manager.xml ?/td> |
Qrole name=”manager”Q?/td> |
Quser name="manager" password="deep_dark_secret" roles="manager"/Q?/td> |
Q?-- Context fragment for deploying MyWebApp.war --Q? QContext path="/demo" docBase="webapps/MyWebApp.war" debug="0" privileged="true"Q? QRealm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/Q? Q?ContextQ?/td> |
QServer port="8005" shutdown="SHUTDOWN" debug="0"Q? QService name="Tomcat-Standalone"Q? QConnector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443"/Q? QConnector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8443" minProcessors="5" maxProcessors="75" acceptCount="10" debug="0" scheme="https" secure="true"/Q? QFactory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory" clientAuth="false" protocol="TLS" /Q? Q?ConnectorQ? QEngine name="Standalone" defaultHost="localhost" debug="0"Q? Q?-- This Host is the default Host --Q? QHost name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true"Q? QContext path="" docBase="ROOT" debug="0"/Q? QContext path="/orders" docBase="/home/ian/orders" debug="0" reloadable="true" crossContext="true"Q? Q?ContextQ? Q?HostQ? Q?-- This Host is the first "Virtual Host": http://www.example.com/ --Q? QHost name="www.example.com" appBase="/home/example/webapp"Q? QContext path="" docBase="."/Q? Q?HostQ? Q?EngineQ? Q?ServiceQ? Q?ServerQ?/td> |
Q?-- Define the Members-only area, by defining a "Security Constraint" on this Application, and mapping it to the subdirectory (URL) that we want to restrict. --Q? Qsecurity-constraintQ? Qweb-resource-collectionQ? Qweb-resource-nameQ? Entire Application Q?web-resource-nameQ? Qurl-patternQ?members/*Q?url-patternQ? Q?web-resource-collectionQ? Qauth-constraintQ? Qrole-nameQmemberQ?role-nameQ? Q?auth-constraintQ? Q?security-constraintQ? Q?-- Define the Login Configuration for this Application --Q? Qlogin-configQ? Qauth-methodQBASICQ?auth-methodQ? Qrealm-nameQMy Club Members-only AreaQ?realm-nameQ? Q?login-configQ?/td> |
QValve className="org.apache.catalina.authenticator.SingleSignOn" debug="0"/Q?/td> |
http://www.cs.myuniversity.edu/~username http://members.mybigisp.com/~username |
QListener className="org.apache.catalina.startup.UserConfig" directoryName="public_html" userClass="org.apache.catalina.startup.PasswdUserDatabase"/Q?/td> |
QListener className="org.apache.catalina.startup.UserConfig" directoryName="public_html" homeBase="/home" userClass="org.apache.catalina.startup.HomesUserDatabase"/Q?/td> |
QservletQ? Qservlet-nameQjspQ?servlet-nameQ? Qservlet-classQ? org.apache.jasper.servlet.JspServlet Q?servlet-classQ? Qinit-paramQ? Qparam-nameQlogVerbosityLevelQ?param-nameQ? Qparam-valueQWARNINGQ?param-valueQ? Q?init-paramQ? Qinit-paramQ? Qparam-nameQcompilerQ?param-nameQ? Qparam-valueQjikesQ?param-valueQ? Q?init-paramQ? Qload-on-startupQ?Q?load-on-startupQ? Q?servletQ?/td> |
QContext path="/path/to/secret_files" ...Q? QValve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1" deny=""/Q? Q?ContextQ?/td> |
Tomcat的目录结构及其用?/font>
?/sup> ?/sup> |
?/sup> ?/sup> |
/bin |
存放启动和关?/sup>Tomcat的脚本文?/sup> |
/common/lib |
存放Tomcat服务器及所?/sup>Web应用E序都可以访问的JAR文g |
/conf |
存放Tomcat服务器的各种配置文gQ其中包?/sup>server.xmlQ?/sup>Tomcat的主要配|文Ӟ?/sup>tomcat-users.xml?/sup>web.xml{配|文?/sup> |
/conf/catalina/localhost |
存放Tomcat服务器对每个目的配|信息,如项目的虚拟目录Q所有项目的目录{信息?/sup> |
work/Catalina/localhost |
存放Tomcatq些目录都是以前我们做的Web应用E序的上下文路径命名的,它里边包括了web应用E序生成的java代码Q和class字节?其中“_”目录对应的是ROOT目录?/sup> |
/logs |
存放Tomcat的日志文?/sup> |
/server/lib |
存放Tomcat服务器运行所需的各U?/sup>JAR文g |
/server/webapps |
存放Tomcat的两?/sup>Web应用E序Q?/sup>admin应用E序?/sup>manager应用E序 |
/shared/lib |
存放所?/sup>Web应用E序都可以访问的JAR文g(不能被tomcat讉K) |
/temp |
存放Tomcatq行时生的临时文g |
/webapps |
当发?/sup>Web应用E序Ӟ通常?/sup>Web应用E序的目录及文g攑ֈq个目录?/sup> |
/work |
Tomcat?/sup>JSP生成?/sup>Servlet源文件和字节码文件放到这个目录下 |
|
|
|
|
|
|
|
|
|
|
从表5-1中可以看刎ͼ/common/lib目录?server/lib?shared/lib目录下都可以存放JAR文gQ它们的区别在于Q?/font>
??server/lib目录下的JAR文g只能被Tomcat服务器访问;
??shared/lib目录下的JAR文g可以被所有的Web应用E序讉KQ但不能被Tomcat服务器访问;
??common/lib目录下的JAR文g可以被Tomcat服务器和所有的Web应用E序讉K?/font>
此外Q对于后面将要介l的Java Web应用E序Q在它的WEB-INF目录下,也可以徏立lib子目录,在lib子目录下可以存放各种JAR文gQ这些JAR文g只能被当前Web应用E序所讉K?/font>