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