nginx 安装

1.

安装PCRE库

cd /usr/local/

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz

tar -zxvf pcre-8.36.tar.gz

cd pcre-8.36

./configure

make

make install

2.安装zlib库

cd /usr/local/

wget http://zlib.net/zlib-1.2.8.tar.gz

tar -zxvf zlib-1.2.8.tar.gz

cd zlib-1.2.8

./configure

make

make install

3.安装openssl

cd /usr/local/

wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz

tar -zxvf openssl-1.0.1c.tar.gz

cd openssl-1.0.1c

./config

make

make install

4.安装nginx

wget http://nginx.org/download/nginx-1.8.0.tar.gz

tar -zxvf nginx-1.8.0.tar.gz

cd nginx-1.8.0

./configure --with-pcre=/usr/local/pcre-8.36 --with-zlib=/usr/local/zlib-1.2.8 --with-openssl=/usr/local/openssl-1.0.1c

make

make install

#user  nobody;
worker_processes  1;

error_log  logs/error.log;

#pid        logs/nginx.pid;


events {
    use   epoll;
    worker_connections  1024;
}


http {
upstream mdx {
server 127.0.0.1:9090 weight=10;
}

    include       mime.types;
    default_type  application/octet-stream;
    access_log  logs/access.log;
    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout  65;
    gzip  on;

    server {
        listen       80;
        server_name  www.jxedt.com womencun.wang guaiv.com madongxue.com *.womencun.wang *.guaiv.com *.madongxue.com;

        location / {
            proxy_pass http://mdx;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

    }
}

相关推荐