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
Table of contents Preface Check and uninstall Ope...
** Detailed graphic instructions for installing y...
Native JS implements the click number game for yo...
In Linux, when a file is created, the owner of th...
Dividing lines are a common type of design on web...
CSS style: Copy code The code is as follows: <s...
Table of contents Preface 1. Nginx installation 1...
This article mainly introduces the analysis of My...
Table of contents Overview Subqueries Subquery Cl...
Preface Nginx (pronounced "engine X") i...
Table of contents 1. Conditional access attribute...
1. Development environment vue 2. Computer system...
Table of contents 1. Resources and Construction 1...
Export a single table mysqldump -u user -p dbname...
In a word: if you buy a cloud server from any maj...