nginx简易配置

下载安装

http://nginx.org/en/download.html

yum install -y pcre pcre-devel openssl openssl-devel
tar -xf nginx-1.14.0.tar.gz 
cd nginx-1.14.0/
./configure --prefix=/usr/local/nginx  --with-http_stub_status_module --with-http_ssl_module
make && make install 

配置

vim /usr/local/nginx/conf/nginx.conf

关键配置

http{

 upstream  web {
        server 127.0.0.1:50002;
        server 127.0.0.1:40002;
        server 127.0.0.1:30002;
        server 127.0.0.1:20002;

    }   

    server {
        listen       60002;
        server_name  127.0.0.1;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
                proxy_pass http://web;
        }
}

运行

# 检查配置文件语法
/usr/local/nginx/sbin/nginx -t 
# 启动
/usr/local/nginx/sbin/nginx 
# 重启
/usr/local/nginx/sbin/nginx -s reload
posted @ 2019-09-03 12:30 lr.cool 阅读(...) 评论(...) 编辑 收藏