nginx安装配置

1.安装依赖包-(web-lnmp-172.16.1.4   LB01-172.16.1.8  LB02-172.16.1.9)

yum install pcre-devel  openssl-devel -y

2.新建目录用户名等-(web-lnmp-172.16.1.4   LB01-172.16.1.8  LB02-172.16.1.9)

mkdir tools

cd tools/

wget url:----

useradd nginx -s /sbin/nologin  -M

3.编译安装nginx-(web-lnmp-172.16.1.4   LB01-172.16.1.8  LB02-172.16.1.9)

tar vxf 

cd nginx-1.6.3

./configure --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module

make

make install

ln -s /application/nginx-1.6.3  /application/nginx

4.nginx负载均衡配置-(LB01-172.16.1.8  LB02-172.16.1.9)

5.nginx web服务配置-(web-lnmp-172.16.1.4)

/application/nginx/sbin/nginx -t

/application/nginx/sbin/nginx -V

/application/nginx/sbin/nginx -s reload

vim /application/nginx/sbin/nginx/conf/nginx.conf

worker_processes  1;

events {

    worker_connections  1024;

}

http {

    include       mime.types;

    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    #nginx vhosts config

include extra/*.conf;

}

cat >/application/nginx/conf/extra/www.conf<<EOF

server {

        listen       80;

        server_name  www.etiantian.org;

        location / {

            root   html/www;

            index  index.html index.htm;

                   }

                    

}

EOF

cat >/application/nginx/conf/extra/bbs.conf<<EOF

 server {

        listen       80;

        server_name  bbs.etiantian.org;

        location / {

            root   html/bbs;

            index  index.html index.htm;

                   }

        }

EOF

cat >/application/nginx/conf/extra/blog.conf<<EOF

server {

        listen       80;

        server_name  blog.etiantian.org;

        location / {

            root   html/blog;

            index  index.html index.htm;

                   }

        }

EOF

cat >/application/nginx/conf/extra/status.conf<<EOF

##STATUS

server {

        listen       80;

        server_name  status.etiantian.org;

        location / {

            stub_status on;

            access_log off;

                   }

       }

EOF