Nginx deploy a Web server and build a Load Balancer server with NFS

Source: Internet
Author: User
Tags nginx server nginx reverse proxy


Nginx deploy a Web server and build a Load Balancer server with NFS


First, build Nginxweb server

This approach is to install Nginx with Yum, to ensure that the installation is successful before installing the Epel extension source prior to installation.

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8E/EF/wKioL1jPdanStzu5AADTNzvDM1A240.png-wh_500x0-wm_ 3-wmp_4-s_827070501.png "title=" 1-1nginx build the installation of the Web server Epel source. png "alt=" wkiol1jpdanstzu5aadtnzvdm1a240.png-wh_50 "/ >

Installing Nginx with Yum

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8E/F2/wKiom1jPf8PSAq2iAACj23Xy_H8219.png-wh_500x0-wm_ 3-wmp_4-s_4201903184.png "title=" 1-2yum mode installation Nginx.png "alt=" Wkiom1jpf8psaq2iaacj23xy_h8219.png-wh_50 "/>

Shutting down the system firewall

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/8E/F2/wKiom1jPf-OiMWM3AACeinc2JNc064.png-wh_500x0-wm_ 3-wmp_4-s_1505490262.png "title=" 1-3 after installing Nginx, the firewall is shut down in advance. png "alt=" wkiom1jpf-oimwm3aaceinc2jnc064.png-wh_50 "/>

View Nginx configuration file

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/8E/F2/wKiom1jPgKewFTAxAACBhgVqn3U743.png-wh_500x0-wm_ 3-wmp_4-s_203969347.png "title=" 1-4 view nginx configuration file Clear home directory location. png "alt=" wkiom1jpgkewftaxaacbhgvqn3u743.png-wh_50 "/>

Start Nginx and view its running status after installation is complete

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8E/F0/wKioL1jPgNegtj9nAADntJLAth0707.png-wh_500x0-wm_ 3-wmp_4-s_1137141549.png "title=" 1-5 start Nginx and view the running status. PNG "alt=" wkiol1jpgnegtj9naadntjlath0707.png-wh_50 "/>

Then enter the IP address of the Nginx server in the client browser to verify that Nginx is working properly

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/8E/F2/wKiom1jPgQ6B_90uAADiRMfa1LY121.png-wh_500x0-wm_ 3-wmp_4-s_2558204278.png "style=" Float:none; "title=" 1-6 Client test access. png "alt=" Wkiom1jpgq6b_90uaadirmfa1ly121.png-wh_ "/>

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8E/F2/wKiom1jPgTfDxl-YAABPChU0Nrc958.png "title=" 1-7 set your own test page and overload the Nginx configuration. png "alt=" Wkiom1jpgtfdxl-yaabpchu0nrc958.png "/>

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/8E/F2/wKiom1jPgQ-C_h1JAACCocYcZOw599.png-wh_500x0-wm_ 3-wmp_4-s_1711618555.png "style=" Float:none; "title=" 1-8 test custom pages. png "alt=" Wkiom1jpgq-c_h1jaaccocyczow599.png-wh_ "/>


Second, build NFS server

NFS: Network File system It allows the sharing of resources between computers in the network over TCP/IP networks. In an NFS application, a local NFS client application can transparently read and write to files located on the remote NFS server, just as you would access a local file.

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8E/F5/wKioL1jP8w_AJmPCAACCYi0Exoo484.png "style=" float : none; "title=" 2-1 Install the NFS server side. png "alt=" Wkiol1jp8w_ajmpcaaccyi0exoo484.png "/>

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8E/F7/wKiom1jP8w_ym_cBAABTZzqK0jc977.png "style=" float : none; "title=" 2-2 Modify the NFS configuration file. png "alt=" Wkiom1jp8w_ym_cbaabtzzqk0jc977.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/8E/F5/wKioL1jP8xDTulvgAAB2jDjXLQg669.png "style=" float : none; "title=" 2-3 turn on the service and set the boot to run automatically. png "alt=" Wkiol1jp8xdtulvgaab2jdjxlqg669.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8E/F7/wKiom1jP8xDxoh5TAABpCdF8ha8440.png "style=" float : none; the "title=" 2-4WEB1 Server Authentication can access the NFS server. png "alt=" Wkiom1jp8xdxoh5taabpcdf8ha8440.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8E/F7/wKiom1jP8xGiMCscAAAocfD05eM325.png "style=" float : none; "title=" 2-5 modifies the contents of a file in the shared directory. png "alt=" Wkiom1jp8xgimcscaaaocfd05em325.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8E/F5/wKioL1jP8xHSsaXbAABDHs30cjA774.png "style=" float : none; "title=" 2-6 verify that the content modified in WEB2 can be seen on web3. png "alt=" Wkiol1jp8xhssaxbaabdhs30cja774.png "/>



Third, the use of nginx to build a reverse proxy server, and the use of polling, weight, and ip_hash the way to dispatch access requests.

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8E/F7/wKiom1jP86Cggeg2AAAIBBvztPI190.png "style=" float : none; "title=" 3-1 modifies web1 server default page content. png "alt=" Wkiom1jp86cggeg2aaaibbvztpi190.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8E/F5/wKioL1jP86HicQHYAAAHnce7pvo801.png "style=" float : none; "title=" 3-2 modifies the contents of the default page in the WEB2 server. png "alt=" Wkiol1jp86hicqhyaaahnce7pvo801.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8E/F7/wKiom1jP86GTvLUZAAAJZ7ypPnI104.png "style=" float : none; "title=" 3-3 modifies the contents of the default page in the WEB3 server. png "alt=" Wkiom1jp86gtvluzaaajz7yppni104.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8E/F5/wKioL1jP86GSNZdcAACD1DdNVFU636.png "style=" float : none; "title=" 3-4 Modify the Nginx configuration file of the reverse proxy server to add the other three server IP addresses to this. png "alt=" Wkiol1jp86gsnzdcaacd1ddnvfu636.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8E/F5/wKioL1jP86KxdijHAABTr9r392c279.png "style=" float : none; "title=" 3-5 sets how the reverse proxy is accessed. png "alt=" Wkiol1jp86kxdijhaabtr9r392c279.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8E/F7/wKiom1jP86Khhxe-AABpTW5u6eg989.png "style=" float : none; "Title=" 3-6 reload the Nginx service of the reverse proxy server and test in the browser. png "alt=" Wkiom1jp86khhxe-aabptw5u6eg989.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/8E/F5/wKioL1jP86OQ8PpRAACO6CGFgOA170.png "style=" float : none; "title=" 3-8 authentication Polling method Access Web server. png "alt=" Wkiol1jp86oq8ppraaco6cgfgoa170.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/8E/F7/wKiom1jP86PRUhopAACnceTwH0E577.png "style=" float : none; "Title=" 3-9 configures the reverse proxy server to allocate request processing in a weighted manner. png "alt=" Wkiom1jp86pruhopaacncetwh0e577.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8E/F7/wKiom1jP86TAHy1JAAB1yyhuGqU548.png "style=" float : none; "title=" 3-11 Verify the access assignment of the reverse proxy server with weighted weights. png "alt=" Wkiom1jp86tahy1jaab1yyhugqu548.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8E/F5/wKioL1jP86SDRQ_vAAC1aMM3ezI969.png "style=" float : none; the "title=" 3-12 setting dispatches access requests in a ip_hash manner. png "alt=" Wkiol1jp86sdrq_vaac1amm3ezi969.png "/>



Four, Nginx reverse proxy + three WEB+NFS shared storage for cluster configuration

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/8E/F5/wKioL1jP9x3iZ-1MAACxeGqGZCs832.png "style=" float : none; "title=" 4-1 Load Balancer server configuration. png "alt=" Wkiol1jp9x3iz-1maacxegqgzcs832.png "/>

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8E/F7/wKiom1jP9x7yE6ksAACuOBnDmbo049.png "style=" float : none; "title=" 4-2 set Load Balancer Server polling. png "alt=" Wkiom1jp9x7ye6ksaacuobndmbo049.png "/>

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8E/F5/wKioL1jP9x7wzrjTAABJPzxX5DY685.png "style=" float : none; "title=" 4-3 set WEB1 Server home directory. png "alt=" Wkiol1jp9x7wzrjtaabjpzxx5dy685.png "/>

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8E/F7/wKiom1jP9x7gvfliAAA0pNLTE9U510.png "style=" float : none; "Title=" 4-4 mount the NFS shared folder to the Web1 home directory and turn off the SELinux firewall. png "alt=" Wkiom1jp9x7gvfliaaa0pnlte9u510.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8E/F5/wKioL1jP9x-i6DI8AABFt0r7lDw285.png "style=" float : none; "title=" 4-5 Configure the root directory of the WEB2 server. png "alt=" Wkiol1jp9x-i6di8aabft0r7ldw285.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8E/F7/wKiom1jP9x_zEbwSAAAoALpmCVs667.png "style=" float : none; "Title=" 4-6 mount NFS shared directory to WEB2. png "alt=" Wkiom1jp9x_zebwsaaaoalpmcvs667.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8E/F5/wKioL1jP9x-QC8dQAAB56T3R8JU340.png "style=" float : none; "title=" 4-7 Configure WEB3 server. png "alt=" Wkiol1jp9x-qc8dqaab56t3r8ju340.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8E/F7/wKiom1jP9yDTL9p1AACFzzoVdfM949.png "style=" float : none; "title=" 4-8 access to content in the share directory. png "alt=" Wkiom1jp9ydtl9p1aacfzzovdfm949.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8E/F5/wKioL1jP9yDhB87xAACBiDiKjyg003.png "style=" float : none; "title=" 4-9 Test finished. png "alt=" Wkiol1jp9ydhb87xaacbidikjyg003.png "/>



Nginx deploy a Web server and build a Load Balancer server with NFS

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.