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
body{font-size:12px; font-family:"宋体";}...
Table of contents 1. Understanding 2. Use 1. h() ...
This article example shares the specific code of ...
When I was writing join table queries before, I a...
When I first started setting up an ftp server on ...
Preface In the previous interview process, when a...
I've been writing a WeChat applet recently an...
1. Use the following command to set the ssh passw...
After many difficult single-step debugging late a...
Table of contents 1. Introduction 2. Several key ...
Here is a record of how to make a scroll bar appe...
Brief description Suitable for readers: Mobile de...
MySQL 5.7.21 winx64 free installation version con...
Database stored procedures DROP PROCEDURE IF EXIS...
Problem description (what is keep-alive) keep-ali...