[JAVA] Azure App Service (Windows) Tomcat configuration changes

About this article

Normally, when using a Java app and changing the settings of Tomcat, "server.xml" is edited, but The file " D: \ Program Files (x86) \ apache-tomcat-x.x.xx \ conf \ server.xml "configured in Azure App Service cannot be modified. Therefore, change the configuration of Tomcat by the following method.

1. Premise

--It is assumed that Java / Tomcat settings have been completed in Apprication settings. --Assuming you are using the Kudu console. https: // <YourAppName> .scm.azurewebsites.net/DebugConsole --The internal image is shown below. Azure.png

1. Directory structure

--Basic directory structure of Azure App Service.

D:.
├─home
│  ├─LogFiles
│  └─site
│      └─wwwroot
│          │  web.config
│          │
│          ├─conf
│          │      server.xml
│          │
│ └─webapps ← apps(.war)Deployment directory
│                  ROOT
│                  ROOT.war
│
└─Program Files (x86)
    └─apache-tomcat-x.x.xx
        └─conf
                server.xml

2. Web.config settings

--It is an IIS configuration file, and you can set additional configurations with arguments when starting Tomcat. --You can set the memory of the JVM. --In the sample below, the modified Tomcat configuration file "server.xml" is set as an argument.

<?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 settings

--Create a "server.xml" file in the path set in 2. above. (D: \ home \ site \ wwwroot \ conf \ server.xml)
* Copy server.xml from " D: \ Program Files (x86) \ apache-tomcat-x.x.xx \ conf \ server.xml "and change it if necessary.

Recommended Posts

Azure App Service (Windows) Tomcat configuration changes
Change Java heap size in Tomcat in Azure App Service
Get Azure App Service for Java Configuration with System.getEnv ()
Build Redmine on Azure App Service
[Java] Deploy the Spring Boot application to Azure App Service