1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Azure App Service (Windows) の Tomcat の構成変更

Last updated at Posted at 2020-09-18

この記事について

通常 Java アプリを使用し Tomcat の設定を変更する際「server.xml」を編集しますが、
Azure App Service で設定されているファイル「D:\Program Files (x86)\apache-tomcat-x.x.xx\conf\server.xml」は変更できません。
そこで以下の方法で Tomcat の構成を変更します。

1.前提

  • Apprication settings で Java / Tomcat の設定が完了しているものとします。
  • Kudu コンソールを利用を想定しています。https://<YourAppName>.scm.azurewebsites.net/DebugConsole
  • 以下に内部のイメージを示します。
    Azure.png

1.ディレクトリ構成

  • Azure App Service の基本的なディレクトリ構成。
D:.
├─home
│  ├─LogFiles
│  └─site
│      └─wwwroot
│          │  web.config
│          │
│          ├─conf
│          │      server.xml
│          │
│          └─webapps ←アプリ(.war)のデプロイディレクトリ
│                  ROOT
│                  ROOT.war
│
└─Program Files (x86)
    └─apache-tomcat-x.x.xx
        └─conf
                server.xml

2.web.config の設定

  • IIS 構成ファイルであり Tomcat を起動するときに引数で追加構成を設定します。
  • JVM のメモリ設定が可能です。
  • 以下のサンプルでは、変更した Tomcat の設定ファイル「server.xml」を引数として設定しています。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<system.webServer>
		<handlers>
			<remove name="httpPlatformHandlerMain" />
			<add name="httpPlatformHandlerMain" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
		</handlers>
		<httpPlatform processPath="D:\Program Files (x86)\apache-tomcat-x.x.xx\bin\startup.bat" requestTimeout="00:04:00" arguments="-config D:\home\site\wwwroot\conf\server.xml start" startupTimeLimit="60" startupRetryCount="3" stdoutLogEnabled="true">
			<environmentVariables>
				<environmentVariable name="CATALINA_OPTS" value="-Xms2048 -Xmx2048m" />
			</environmentVariables>
		</httpPlatform>
	</system.webServer>
</configuration>

3.server.xml の設定

  • 上記2.で設定したパスに「server.xml」ファイルを作成します。(D:\home\site\wwwroot\conf\server.xml)

    ※server.xmlは「D:\Program Files (x86)\apache-tomcat-x.x.xx\conf\server.xml」からコピーし、必要に応じて変更してください。
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?