centos 6.9 安装nginx

=============================================

个人操作记录:

config:


worker_processes  1;
events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

upstream myServer{
        server 192.168.2.131:80 weight=9;  #这里是你自己要做负载均衡的服务器地址1
        server 192.168.2.162:8080 weight=1; #这里是要参与负载均衡的地址2
    }
    


    server {
        listen 8080;
        server_name  localhost;   
        location / {
           proxy_pass  http://myServer;        
        } 
    }
    sendfile        on; 
    keepalive_timeout  65;
}

./nginx -s stop

./nginx -c /usr/local/bin/nginx-1.7.9/conf/nginx.conf

./nginx -s reload

=============================================

请看原文 地址:https://www.cnblogs.com/xxx91hx/p/4245901.html

[root@localhost src]# wget http://nginx.org/download/nginx-1.7.9.tar.gz
[root@localhost src]# tar zxvf nginx-1.7.9.tar.gz 
[root@localhost nginx-1.7.9]# yum -y install gcc-c++
[root@localhost nginx-1.7.9]# yum -y install pcre-devel
[root@localhost nginx-1.7.9]# yum -y install zlib-devel
[root@localhost nginx-1.7.9]# ./configure --prefix=/usr/etc/ngin
[root@localhost nginx-1.7.9]# make
[root@localhost nginx-1.7.9]# make install

启动nginx
[root@localhost nginx-1.7.9]# cd /usr/etc
[root@localhost etc]# ls
ngin
[root@localhost etc]# cd ngin
[root@localhost ngin]# ls
conf  html  logs  sbin
[root@localhost ngin]# cd sbin
[root@localhost sbin]# ls
nginx
[root@localhost sbin]# ./nginx
查看是否启动
[root@localhost sbin]# ps -ef|grep nginx
重启
[root@localhost sbin]# ./nginx -s reload
暂停
[root@localhost sbin]# ./nginx -s stop
访问 http://192.168.1.103/

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值