questionWhen we are developing normally, if we want to deploy the project to Tomcat, the general practice is to package the project into a war package, then throw the war package into the webapps directory of Tomcat, and then start the project. However, when deploying a project to a production environment, the configuration files of the production environment are generally different from those of the local development environment. In this case, it is more troublesome to deploy the project to production using the method just described. You need to manually delete the original configuration files, or exclude the configuration files when packaging, and then copy the correct configuration files to the resource directory of the project. So, is there a simpler way? Workaround We can put the configuration files in a fixed location on the server, such as /var/config. Then import these configuration files into Tomcat.
Special note: appContext here is the context of your project, you need to change it to your own project context name, for example: taobao.xml Fill in appContext.xml like this <Context path ="/appContext" docBase ="/home/tools/apps/appContext.war" debug ="0" privileged ="true" reloadable ="true" > <Parameter name="" value="/home/tools/config" override="false"/> </Context> path: fill in the context of your project docBase: fill in the war package path value: fill in the project configuration file path Go back to the Tomcat directory, then enter the bin directory and modify the setenv.sh file CLASSPATH=$CLASSPATH:/home/tools/config If this file does not exist, create it and set executable permissions.
Finally, let me share a little knowledge, Tomcat sets the memory size In the bin directory of Tomcat, open the catalina.sh file and add the following line to the first line of the official code: JAVA_OPTS="-server -Xms128m -Xmx256m -XX:PermSize=64M -XX:MaxPermSize=128m" Summarize This is the end of this article about placing Tomcat configuration files externally. For more information about placing Tomcat configuration files externally, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: How to create your first React page
>>: Web Standard Application: Redesign of Tencent QQ Home Page
A system administrator may manage multiple server...
MySQL Limit can query database data in segments a...
1. CSS background tag 1. Set the background color...
I have installed various images under virtual mac...
introduction In recent years, the call for TypeSc...
Table of contents Using conditional types in gene...
Table of contents Preface 1. Null coalescing oper...
Preface In some cases, we only know the intranet ...
Table of contents 1. Understanding Queues 2. Enca...
First time using docker to package and deploy ima...
When logging in to the stress test, many differen...
Anyone in need can refer to it. If you have tried...
MySQL encryption and decryption examples Data enc...
The layout of text has some formatting requiremen...
Tetris is a very classic little game, and I also ...