1. Reverse proxy preparation1. Install Tomcat in Linux systemUnzip tomcat to /usr/src. The jdk environment is required to start. If you don't have a jdk environment, install it. My centos7 comes with jdk1.8. 2. Start tomcatEnter the bin directory of tomcat, there is a startup.sh file. ./startup.sh starts the tomcat server 3. Ports open to external accessView currently open port numbers firewall-cmd --list-all Set the open port number firewall-cmd --add-port=80/tcp --permanent firewall-cmd --add-port=8080/tcp --permanent Restart the firewall firewall-cmd --reload 4. Test access to tomcathttp://192.168.1.173:8080/ The preliminary preparations are now complete!! 2. Reverse proxy case (I)1. Achieve resultsOpen the browser, enter www.123.com in the browser address bar, and jump to the Linux system tomcat page 2. Specific configurationStep 1: Add to the local /etc/hosts file The second step is to configure request forwarding in nginx (reverse proxy configuration)
Modify and add some content 3. TestingVisit www.123.com Access tomcat by accessing nginx's ip, success! ! ! ! 2. Reverse proxy case (II)Achieve resultsUse nginx reverse proxy to jump to services on different ports according to the access path. The nginx listening port is 9001.
1. Preparation(1) Prepare two tomcat servers, one with port 8080 and one with port 8081 (2) Create two folders, put the compressed packages of Tomcat in each folder, decompress them, and then modify the server.xml file in the conf file of one of the Tomcat files and change the port to 8081. (3) Create edu and vod folders under the webapps file, and create an a.html test page in the folder to display the port number. 2. Specific configuration(1) Find the nginx configuration file and configure the reverse proxy (2) Open ports for external access: 9001 8080 8081 location directive descriptionThis directive is used to match URLs The syntax is as follows: location [ = | ~ | ~* | ^~] uri { } 1. =: used before a URI that does not contain a regular expression, requiring the request string to strictly match the URI. If they match If successful, stop searching further and process the request immediately. 2. ~: Used to indicate that the URI contains a regular expression and is case-sensitive. 3. ~*: used to indicate that the URI contains a regular expression and is case insensitive. 4. ^~: used before the URI without regular expression, requiring the Nginx server to find the identifier URI and the request string After the location with the highest string matching degree is found, the request is processed immediately using this location instead of the location The regular uri in the block is matched against the request string. Note: If the uri contains a regular expression, the ~ or ~ sign must be present . * Final TestSummarizeThis is the end of this article about Nginx reverse proxy learning. For more relevant Nginx reverse proxy content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: A brief discussion on the difference between MYSQL primary key constraint and unique constraint
>>: How to set the select to be read-only and not editable and the select value to be passable
Since Zabbix version 3.0, it has supported encryp...
Currently encountering such a problem My situatio...
When making a form in a recent project, I need to...
Introduce two methods to view MySQL user permissi...
Table of contents Environment Preparation Environ...
hint This plug-in can only be accessed under the ...
We may have a question: After we install MySQL lo...
Note: sg11 Our company only supports self-install...
In Linux operations, we often replace and count s...
Table of contents Inheritance ES5 prototype inher...
Table of contents Pull the rocketmq image Create ...
Table of contents Join syntax: 1. InnerJOIN: (Inn...
Table of contents Diffing Algorithm Layer-by-laye...
HTML is made up of tags and attributes, which are...
Table of contents Preface Rendering setTable comp...