Nginx-1.9.7 TCP reverse proxy (short)

Source: Internet
Author: User

Nginx-1.9.7 TCP reverse proxy (short)

This is called reverse proxy. It just seems that the structure is similar to the Nginx-Tomcat reverse proxy cluster. it's not official ~
Add the script address to the end

---------------------------------------- Body ----------------------------------------

Nginx-1.9.7 can be downloaded in the official, built-in TCP Agent module, but need to add parameters to the plaintext when the compilation is specified to compile in
Refer to the official documentation and add the following parameters during compilation: -- with-stream
Then make & make install to complete the compilation and installation (this article introduces a lot of nginx installation materials and does not repeat them)
---------------------------------------- Configuration & verification ----------------------------------------

Add a simple configuration file

Stream {
Upstream mysql {
Hash $ remote_addr consistent;
Server MySQL_URL: 3306 max_fails = 3 fail_timeout = 30 s;
}

Server {
Listen 13579;
Proxy_connect_timeout 30 s;
Proxy_timeout 600 s;
Proxy_pass mysql;
}
}

Check the port status after startup

Different from the reverse proxy of HTTP, it is in the whole module, instead of the http module, but the stream module. The syntax in the module is basically the same. In upstream, we can see that the Nginx load balancing policy can still be used, so the Nginx-1.9.x successfully joined the MySQL middleware luxury lunch ~
Then try to connect to MySQL through remote network access on other machines

We can see that MySQL can be accessed through the port 13579.

---------------------------------------- Split line ----------------------------------------

Deployment of Nginx + MySQL + PHP in CentOS 6.2

Build a WEB server using Nginx

Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5

Performance Tuning for Nginx in CentOS 6.3

Configure Nginx to load the ngx_pagespeed module in CentOS 6.3

Install and configure Nginx + Pcre + php-fpm in CentOS 6.4

Nginx installation and configuration instructions

Nginx log filtering using ngx_log_if does not record specific logs

---------------------------------------- Purpose ----------------------------------------

For usage purposes, we can consider using Nginx as the middleware to build a dual-master, multi-slave HA cluster, and then write a script to monitor the status of the slave database to switch Nginx in real time, block the slave database corresponding to the master database of the down machine or the slave database that is down, and then increase the number by 5.7. Use the multi-master mode to horizontally expand the write capability of the MySQL cluster, at the same time, the script for monitoring slave database can also omit the vertex logic, so you do not need to judge whether the corresponding master database fails.

After two sets of solutions are made, verify the actual availability, performance, and so on... the recent plan is almost done ~

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.