Build Nginx Http/Tcp proxy server Guide Line

来源:互联网 发布:java项目中多线程使用 编辑:程序博客网 时间:2024/06/02 01:59

Deployment environment:

System : windows 7
Software : nginx-1.9.0 , MySQL-Front , MySQL 5.7

First step : Download and install the Nginx server software.

1.Download url : http://nginx.org/en/download.html (Version 1.9 and above)
这里写图片描述

2.Unzip the download nginx files to the install folder and rename folder to “nginx”
这里写图片描述

Second Stop: Start and test the Nginx.

1.edit the nginx -> conf -> nginx.conf file (Optional step )
Change the listen port ( default is 80 ):
这里写图片描述
2.enter the nginx ,double click the nginx.exe or start in the command line. (Must Step)

Command line method:
这里写图片描述

Open the task manager -> Processes ( must )
这里写图片描述

Test in browser:
这里写图片描述

Third step : Add the TCP proxy module in nginx.conf and testing.

1.add the stream module to nginx.conf (end of the text )
stream {
upstream cloudsocket {
hash $remote_addr consistent;
server 127.0.0.1:3306 weight=5 max_fails=3 fail_timeout=30s;}
server {
listen 2014;
proxy_connect_timeout 30s;
proxy_timeout 600s;
proxy_pass cloudsocket;
}
}
这里写图片描述

2.reload the conf through command line.
这里写图片描述

3.Test in other competer to connect mysql Database through port 2014.
Using the MySQL-Front connect :
这里写图片描述

If the connection successful and allow to operate the database, signify the nginx has been set up successfully.
Ps:the mysql account is test data,must use real accounts when you deploy.

Ps:自己写的Guide Line,英文太差,有错欢迎指出,指出必改,非常感谢。

0 0
原创粉丝点击