Multi-application deployment1-tomcat configuration1.1- Project Configuration First, go to the cp webapps webapps1 At this point, you can deploy the second project in the same way as deploying a normal project, and upload the data package to the 1.2-Service Configuration Go to the cd confvim server.xml At the end of the file, add a service resolution configuration. <!-- Second project configuration--> <Service name="Catalina1"> <!-- To avoid conflicts, change the port --> <Connector port="81" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <!-- Tomcat uses port 8009 by default, to avoid conflicts, modify --> <Connector port="8010" protocol="AJP/1.3" redirectPort="8443"/> <!-- Engine node, name changed to Catalina1 --> <!-- After the service is started, the corresponding engine folder will be generated under conf, and the name will remain the same. --> <Engine name="Catalina1" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <!-- Modify the Host node and change appBase to the location of the file to be published, which is webapps1 copied in the first step --> <Host name="localhost" appBase="webapps1" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine> </Service> 2-Nginx Configuration First, go to the vim nginx.conf Add the reverse proxy configuration information inside # Website is just a random name, it is just an identification, and the corresponding ip:port that needs to be proxied is inside it. # Multiple services can also be directly filled in, nginx will automatically load upstream website{ server localhost:81; server localhost:82; } server{ listen 80; # Configure the domain name information that needs to be resolved, and ensure that this domain name can access the current server's server_name www.123.com; location / { #Put the above defined object below for proxy_pass http://website; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 3-Complete deployment After completing the above two steps, restart # Enter the bin directory and restart tomcat ./shutdown.sh ./startup.sh # Enter the sbin directory and restart nginx ./nginx -s reload This concludes this article on sample code for implementing multi-application deployment with tomcat+nginx. For more information on multi-application deployment with tomcat+nginx, please search previous articles on 123WORDPRESS.COM or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of CSS3 animation and new features of HTML5
>>: The functions and differences between disabled and readonly
1. Commonly used high-order functions of arrays S...
First, the structure inside the nginx container: ...
Concept introduction: We know that the redo log i...
I wrote a jsp page today. I tried to adjust <di...
Table of contents Preface Bubble Sort Basic Algor...
The default scroll bar style in Windows is ugly, ...
Table of contents 1 Background 2 Create a contain...
I installed it in msi format, mainly to see the m...
This article shares the specific code for JavaScr...
The image can be saved on hub.docker.com, but the...
After the image is built successfully, it can be ...
Table of contents Preface: 1. Create index method...
A frame is a web page screen divided into several ...
Table of contents Scenario Effect Code Summarize ...
Table of contents Primary key index Create indexe...