Go CENTOS 6.5 configuration Yum install nginx+ server load Balancer

Source: Internet
Author: User

Original connection: CENTOS 6.5 configuration yum installation Nginx http://blog.sina.com.cn/s/blog_69f467b70102uyux.html

This article describes how to install Nginx with a yum source.

The first step is to /etc/yum.repos.d/ create a source configuration file under the directory nginx.repo :

cd/etc/yum.repos.d/  vim Nginx.repo

Fill in the following content:

[Nginx]name=nginx repo  baseurl=http://nginx.org/packages/centos/$releasever/  $basearch/  gpgcheck=0  enabled=1

save, you will produce a /etc/yum.repos.d/nginx.repo file.

The following instructions can be executed directly below to install Nginx automatically:

Yum Install Nginx-y

The installation is complete, the following directly can start Nginx:

/etc/init.d/nginx start

I'm using: Service start up and set boot up

--level 35

Simple Load Balancing

The company currently has only two servers to do the load:

My configuration is as follows:

User Nginx;worker_processes1; Error_log/var/log/nginx/Error.log warn;pid/var/run/nginx.pid;events {use epoll; Worker_connections1024;} HTTP {include/etc/nginx/mime.types; Default_type Application/octet-stream; Log_format Main '$remote _addr-$remote _user[$time _local]"$request""'$status $body _bytes_sent "$http _referer""'"$http _user_agent" "$http _x_forwarded_for"'; Access_log/var/log/nginx/Access.log Main;    Sendfile on; #Tcp_nopush on;Keepalive_timeout65; #gzip on;include/etc/nginx/conf.d/*. conf; #set the server list for load Balancingupstream MyServer {#the Weigth parameter represents weights, the higher the weight, the greater the chance of being allocated.      #Apache on this machine open 8080 portServer Native ip:8080 weight=5; Server Webserver2 Weight=5; } Server {Listen80;      server_name native IP; Location/{proxy_pass http://MyServer; Proxy_set_header Host$host; Proxy_set_header X-real-ip$remote _addr; Proxy_set_header X-forwarded- for $proxy _add_x_forwarded_for; }    }}

Done! Is it just that database access will become a bottleneck? I'll solve it later!

Go CENTOS 6.5 configuration Yum install nginx+ server load Balancer

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.