1 | <?xml version="1.0" encoding="UTF-8" ?> |
---|
2 | <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> |
---|
3 | |
---|
4 | <!-- This configuration supports Jetty 9. Do not remove this line. --> |
---|
5 | |
---|
6 | <!-- ========================================================================= --> |
---|
7 | <!-- This file configures the Jetty server. --> |
---|
8 | <!-- All changes require a restart of I2P. --> |
---|
9 | <!-- --> |
---|
10 | <!-- Commonly changed settings: --> |
---|
11 | <!-- * host: Change 127.0.0.1 to 0.0.0.0 in the addListener section --> |
---|
12 | <!-- to access the server directly (bypassing i2p) --> |
---|
13 | <!-- from other computers. --> |
---|
14 | <!-- * port: Default 7658 in the addConnector section --> |
---|
15 | <!-- * docroot: Change the ResourceBase in the contexts/base-context.xml file --> |
---|
16 | <!-- to serve files from a different location. --> |
---|
17 | <!-- * threads: Raise maxThreads in the ThreadPool section --> |
---|
18 | <!-- if you have a high-traffic site and get a lot of warnings. --> |
---|
19 | <!-- * Uncomment the addWebApplications section to use to enable --> |
---|
20 | <!-- war files placed in the webapps/ dir. --> |
---|
21 | <!-- * Uncomment the line to allow Jetty to follow symlinks --> |
---|
22 | <!-- --> |
---|
23 | <!-- I2P uses Jetty 9. If you need web server features not found --> |
---|
24 | <!-- in Jetty 9, you may install and run Jetty 7 or 8 in a different JVM --> |
---|
25 | <!-- or run any other web server such as Apache. If you do run another web --> |
---|
26 | <!-- server instead, be sure and disable the Jetty 9 server for your --> |
---|
27 | <!-- eepsite on http://127.0.0.1:7657/configclients.jsp . --> |
---|
28 | <!-- --> |
---|
29 | <!-- Jetty now uses the I2P logging system rather than wrapper.log. --> |
---|
30 | <!-- Use the log override org.eclipse.jetty.server.Server to adjust the log level. --> |
---|
31 | <!-- --> |
---|
32 | <!-- Note that the XML encoding for this file is UTF-8. --> |
---|
33 | <!-- --> |
---|
34 | <!-- If you have a 'split' directory installation, with configuration --> |
---|
35 | <!-- files in ~/.i2p (Linux), %APPDATA%\I2P (Windows), --> |
---|
36 | <!-- or /Users/(user)/Library/Application Support/i2p (Mac), be sure to --> |
---|
37 | <!-- edit the file in the configuration directory, NOT the install directory. --> |
---|
38 | <!-- When running as a Linux daemon, the configuration directory is --> |
---|
39 | <!-- /var/lib/i2p and the install directory is /usr/share/i2p . --> |
---|
40 | <!-- When running as a Windows service, --> |
---|
41 | <!-- the configuration directory is \ProgramData\i2p --> |
---|
42 | <!-- and the install directory is \Program Files\i2p . --> |
---|
43 | <!-- --> |
---|
44 | <!-- ========================================================================= --> |
---|
45 | |
---|
46 | <!-- ========================================================================= --> |
---|
47 | <!-- Configure the Jetty Server --> |
---|
48 | <!-- --> |
---|
49 | <!-- Documentation of this file format can be found at: --> |
---|
50 | <!-- http://www.eclipse.org/jetty/documentation/current/jetty-xml-config.html --> |
---|
51 | <!-- --> |
---|
52 | <!-- ========================================================================= --> |
---|
53 | |
---|
54 | |
---|
55 | <Configure id="Server" class="org.eclipse.jetty.server.Server"> |
---|
56 | |
---|
57 | <!-- =========================================================== --> |
---|
58 | <!-- Server Thread Pool --> |
---|
59 | <!-- =========================================================== --> |
---|
60 | <Arg> |
---|
61 | |
---|
62 | <!-- PICK ONE --> |
---|
63 | |
---|
64 | <!-- |
---|
65 | Recommended. |
---|
66 | Two threads are used for the Connector and Acceptor. |
---|
67 | Concurrent requests above maxThreads + queue size - 2 will be rejected and logged. |
---|
68 | Due to the way QTP works, queue size should be larger than maxThreads. |
---|
69 | Increase all values for high-traffic eepsites. |
---|
70 | |
---|
71 | ref: |
---|
72 | https://wiki.eclipse.org/Jetty/Howto/High_Load |
---|
73 | http://trac.i2p2.i2p/ticket/1395 |
---|
74 | --> |
---|
75 | <New class="org.eclipse.jetty.util.thread.QueuedThreadPool"> |
---|
76 | <Arg type="int">20</Arg> <!-- maxThreads, overridden below --> |
---|
77 | <Arg type="int">3</Arg> <!-- minThreads, overridden below --> |
---|
78 | <Arg type="int">60000</Arg> <!-- maxIdleTimeMs, overridden below --> |
---|
79 | <Arg> |
---|
80 | <New class="java.util.concurrent.LinkedBlockingQueue"> |
---|
81 | <Arg type="int">40</Arg> |
---|
82 | </New> |
---|
83 | </Arg> |
---|
84 | <Set name="minThreads">3</Set> |
---|
85 | <Set name="maxThreads">20</Set> |
---|
86 | <Set name="idleTimeout">60000</Set> |
---|
87 | <Set name="daemon">true</Set> |
---|
88 | <Set name="name">Eepsite Jetty</Set> |
---|
89 | </New> |
---|
90 | </Arg> |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | <!-- =========================================================== --> |
---|
95 | <!-- Set connectors --> |
---|
96 | <!-- =========================================================== --> |
---|
97 | <!-- One of each type! --> |
---|
98 | <!-- =========================================================== --> |
---|
99 | |
---|
100 | <!-- Use this connector for many frequently idle connections |
---|
101 | and for threadless continuations. |
---|
102 | Not recommended on Java 5 - comment this out, and uncomment the |
---|
103 | SocketConnector below. |
---|
104 | Do not use for gij or JamVM - comment this out, and uncomment the |
---|
105 | SocketConnector below. |
---|
106 | --> |
---|
107 | <Call name="addConnector"> |
---|
108 | <Arg> |
---|
109 | <New class="org.eclipse.jetty.server.ServerConnector"> |
---|
110 | <Arg><Ref id="Server" /></Arg> |
---|
111 | <Arg type="int">1</Arg> <!-- number of acceptors --> |
---|
112 | <Arg type="int">0</Arg> <!-- default number of selectors --> |
---|
113 | <Arg> |
---|
114 | <Array type="org.eclipse.jetty.server.ConnectionFactory"> <!-- varargs so we need an array --> |
---|
115 | <Item> |
---|
116 | <New class="org.eclipse.jetty.server.HttpConnectionFactory"> |
---|
117 | <Arg> |
---|
118 | <New class="org.eclipse.jetty.server.HttpConfiguration"> |
---|
119 | <Set name="sendServerVersion">false</Set> |
---|
120 | <Set name="sendDateHeader">false</Set> |
---|
121 | <Set name="sendXPoweredBy">false</Set> |
---|
122 | </New> |
---|
123 | </Arg> |
---|
124 | </New> |
---|
125 | </Item> |
---|
126 | </Array> |
---|
127 | </Arg> |
---|
128 | <Set name="host">127.0.0.1</Set> |
---|
129 | <Set name="port">7658</Set> |
---|
130 | <Set name="idleTimeout">600000</Set> |
---|
131 | </New> |
---|
132 | </Arg> |
---|
133 | </Call> |
---|
134 | |
---|
135 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
---|
136 | <!-- To add a HTTPS SSL listener --> |
---|
137 | <!-- see jetty-ssl.xml to add an ssl connector. use --> |
---|
138 | <!-- To enable this change clients.config args to be: --> |
---|
139 | <!-- --> |
---|
140 | <!-- clientApp3.args=etc/jetty.xml etc/jetty-ssl.xml --> |
---|
141 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
---|
142 | |
---|
143 | <!-- =========================================================== --> |
---|
144 | <!-- Set up global session ID manager --> |
---|
145 | <!-- =========================================================== --> |
---|
146 | <!-- |
---|
147 | <Set name="sessionIdManager"> |
---|
148 | <New class="org.eclipse.jetty.server.session.HashSessionIdManager"> |
---|
149 | <Set name="workerName">node1</Set> |
---|
150 | </New> |
---|
151 | </Set> |
---|
152 | --> |
---|
153 | |
---|
154 | <!-- =========================================================== --> |
---|
155 | <!-- Set handler Collection Structure --> |
---|
156 | <!-- =========================================================== --> |
---|
157 | <Set name="handler"> |
---|
158 | <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"> |
---|
159 | <Set name="handlers"> |
---|
160 | <Array type="org.eclipse.jetty.server.Handler"> |
---|
161 | <Item> |
---|
162 | <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/> |
---|
163 | </Item> |
---|
164 | <Item> |
---|
165 | <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/> |
---|
166 | </Item> |
---|
167 | <Item> |
---|
168 | <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/> |
---|
169 | </Item> |
---|
170 | </Array> |
---|
171 | </Set> |
---|
172 | </New> |
---|
173 | </Set> |
---|
174 | |
---|
175 | <!-- =============================================================== --> |
---|
176 | <!-- Create the deployment manager --> |
---|
177 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
---|
178 | <!-- The deplyment manager handles the lifecycle of deploying web --> |
---|
179 | <!-- applications. Apps are provided by instances of the --> |
---|
180 | <!-- AppProvider interface. Typically these are provided by --> |
---|
181 | <!-- one or more of: --> |
---|
182 | <!-- jetty-webapps.xml - monitors webapps for wars and dirs --> |
---|
183 | <!-- jetty-contexts.xml - monitors contexts for context xml --> |
---|
184 | <!-- jetty-templates.xml - monitors contexts and templates --> |
---|
185 | <!-- =============================================================== --> |
---|
186 | <Call name="addBean"> |
---|
187 | <Arg> |
---|
188 | <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager"> |
---|
189 | <Set name="contexts"> |
---|
190 | <Ref id="Contexts" /> |
---|
191 | </Set> |
---|
192 | <Call name="setContextAttribute"> |
---|
193 | <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg> |
---|
194 | <Arg>.*/.*jsp-api-[^/]*\.jar$|.*/.*jsp-[^/]*\.jar$|.*/.*taglibs[^/]*\.jar$</Arg> |
---|
195 | </Call> |
---|
196 | </New> |
---|
197 | </Arg> |
---|
198 | </Call> |
---|
199 | |
---|
200 | <!-- =========================================================== --> |
---|
201 | <!-- Configure the context deployer --> |
---|
202 | <!-- A context deployer will deploy contexts described in --> |
---|
203 | <!-- configuration files discovered in a directory. --> |
---|
204 | <!-- The configuration directory can be scanned for hot --> |
---|
205 | <!-- deployments at the configured scanInterval. --> |
---|
206 | <!-- --> |
---|
207 | <!-- This deployer is configured to deploy contexts configured --> |
---|
208 | <!-- in the $JETTY_HOME/contexts directory --> |
---|
209 | <!-- --> |
---|
210 | <!-- =========================================================== --> |
---|
211 | <Ref id="DeploymentManager"> |
---|
212 | <Call name="addAppProvider"> |
---|
213 | <Arg> |
---|
214 | <New class="org.eclipse.jetty.deploy.providers.WebAppProvider"> |
---|
215 | <Set name="monitoredDirName">./eepsite/contexts</Set> |
---|
216 | <Set name="scanInterval">120</Set> |
---|
217 | </New> |
---|
218 | </Arg> |
---|
219 | </Call> |
---|
220 | </Ref> |
---|
221 | |
---|
222 | <!-- =========================================================== --> |
---|
223 | <!-- Configure the webapp deployer. --> |
---|
224 | <!-- A webapp deployer will deploy standard webapps discovered --> |
---|
225 | <!-- in a directory at startup, without the need for additional --> |
---|
226 | <!-- configuration files. It does not support hot deploy or --> |
---|
227 | <!-- non standard contexts (see ContextDeployer above). --> |
---|
228 | <!-- --> |
---|
229 | <!-- This deployer is configured to deploy webapps from the --> |
---|
230 | <!-- $JETTY_HOME/webapps directory --> |
---|
231 | <!-- --> |
---|
232 | <!-- Normally only one type of deployer need be used. --> |
---|
233 | <!-- --> |
---|
234 | <!-- =========================================================== --> |
---|
235 | <Ref id="DeploymentManager"> |
---|
236 | <Call id="webappprovider" name="addAppProvider"> |
---|
237 | <Arg> |
---|
238 | <New class="org.eclipse.jetty.deploy.providers.WebAppProvider"> |
---|
239 | <Set name="monitoredDirName">./eepsite/webapps</Set> |
---|
240 | <Set name="parentLoaderPriority">false</Set> |
---|
241 | <Set name="extractWars">false</Set> |
---|
242 | <Set name="defaultsDescriptor">./eepsite/etc/webdefault.xml</Set> |
---|
243 | </New> |
---|
244 | </Arg> |
---|
245 | </Call> |
---|
246 | </Ref> |
---|
247 | |
---|
248 | <!-- ===================== --> |
---|
249 | <!-- DefaultHandler config --> |
---|
250 | <!-- http://stackoverflow.com/questions/4202275/how-to-prevent-jetty-from-showing-context-related-information --> |
---|
251 | <!-- ===================== --> |
---|
252 | <Ref id="DefaultHandler"> |
---|
253 | <Set name="showContexts">false</Set> |
---|
254 | </Ref> |
---|
255 | |
---|
256 | <!-- =========================================================== --> |
---|
257 | <!-- Configure Authentication Realms --> |
---|
258 | <!-- Realms may be configured for the entire server here, or --> |
---|
259 | <!-- they can be configured for a specific web app in a context --> |
---|
260 | <!-- configuration (see $(jetty.home)/contexts/test.xml for an --> |
---|
261 | <!-- example). --> |
---|
262 | <!-- =========================================================== --> |
---|
263 | <!-- UNCOMMENT TO ACTIVATE |
---|
264 | <Set name="UserRealms"> |
---|
265 | <Array type="org.eclipse.jetty.security.LoginService"> |
---|
266 | <Item> |
---|
267 | <New class="org.eclipse.jetty.security.HashLoginService"> |
---|
268 | <Set name="name">Test Realm</Set> |
---|
269 | <Set name="config">./eepsite/etc/realm.properties</Set> |
---|
270 | <Set name="refreshInterval">0</Set> |
---|
271 | </New> |
---|
272 | </Item> |
---|
273 | </Array> |
---|
274 | </Set> |
---|
275 | --> |
---|
276 | |
---|
277 | <!-- =========================================================== --> |
---|
278 | <!-- Configure Request Log --> |
---|
279 | <!-- Request logs may be configured for the entire server here, --> |
---|
280 | <!-- or they can be configured for a specific web app in a --> |
---|
281 | <!-- contexts configuration (see $(jetty.home)/contexts/test.xml --> |
---|
282 | <!-- for an example). --> |
---|
283 | <!-- =========================================================== --> |
---|
284 | <Ref id="RequestLog"> |
---|
285 | <Set name="requestLog"> |
---|
286 | <New id="RequestLogImpl" class="net.i2p.jetty.I2PRequestLog"> |
---|
287 | <Set name="filename">./eepsite/logs/yyyy_mm_dd.request.log</Set> |
---|
288 | <Set name="filenameDateFormat">yyyy_MM_dd</Set> |
---|
289 | <Set name="retainDays">90</Set> |
---|
290 | <Set name="append">true</Set> |
---|
291 | <Set name="extended">false</Set> |
---|
292 | <Set name="logCookies">false</Set> |
---|
293 | <Set name="LogTimeZone">GMT</Set> |
---|
294 | <!-- False for b32 logging. True for b64 logging. Default false --> |
---|
295 | <Set name="b64">false</Set> |
---|
296 | </New> |
---|
297 | </Set> |
---|
298 | </Ref> |
---|
299 | |
---|
300 | <!-- =========================================================== --> |
---|
301 | <!-- extra options --> |
---|
302 | <!-- =========================================================== --> |
---|
303 | <Set name="stopAtShutdown">true</Set> |
---|
304 | <Set name="stopTimeout">1000</Set> |
---|
305 | |
---|
306 | </Configure> |
---|