Install and configure nginx in centos, and use IIS for Load Balancing

Source: Internet
Author: User
I. Environment preparation
    • Install centos: 6.2

      For centos introduction, see: http://baike.baidu.com/view/26404.htm
    • Nginx version: 1.2.1 about nginx, see: http://baike.baidu.com/view/926025.htm
2. Linux Common commands to introduce how to do things well, you must first sharpen the tool. Before operating the Linux system, we must master some basic commands. I believe that no one who has used DOS is familiar with these commands, including windows, Linux, the command line mode is developed from the UNIX system. Only a few commands are listed here. For more information, see related documents.

ls used to display files and directories in a specific path example: ls-A
Cd enter a directory or return the parent directory For example: CD/directory; CD ..
ps display Process Information example: PS-Ef | grep nginx
mkdir create a directory example: mkdir yourdir
rmdir delete a directory
RM delete an object
kill terminate the process for example, kill-term PID sends a term signal to the parent process to kill processes and sub-processes
logout cancel the current session
Reboot restart the system
Yum install related tool kits
setup set the network and firewall
VI Vim Text Editor For example: VI/usr/local/nginx/CONF/nginx. conf
3. Install nginx after centos is installed, use the root user to enter the system, and use the wget method to install the nginx package

    • Wget http://www.nginx.org/download/nginx-1.2.1.tar.gz
    • Extract package tar-zxvf nginx-1.2.1.tar.gz
    • Install the GCC compiler and related tools Yum-y install GCC gcc-C ++ Autoconf automake make
    • Install the dependent module Yum-y install zlib-devel OpenSSL -- devel PCRE-devel
    • Install by compiling the source code:./configure
    • Execute the command: Make
    • Run the command: make install
Iv. nginx configuration file example:

Configuration File description:

    • Nginx server acts as a front-end reverse proxy
    • Configure two backend IIS servers as the shunt Server
    • Load Method Based on IP-Hash
    • Test whether the configuration file has an error:/$ your directory/nginx/sbin/nginx-T
5. How to start nginx and run the file to start: #/usr/local/nginx/sbin/nginx
After the nginx process is started successfully, check the nginx process information: # ps-Ef | grep nginx and check whether the nginx process exists to check whether the nginx process has been started successfully. Check the centos firewall settings and whether the corresponding port is enabled. You can use the setup command to Set firewall, DNS, network, and other information. If no changes are made to the default configuration file, you can directly access the nginx server using a browser. The following message is displayed: Welcome to nginx 6. According to the above steps, the test environment has been created, nginx can proxy front-end requests well and distribute requests to backend IIS. Session and cookie seem to be okay. The detailed test is still in progress. If there is no problem, we will use it in the formal production environment. There is nothing wrong with bringing excellent software in Linux to serve the. NET system! Web development should be open and inclusive.
Related Article

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.