现在的位置: 首页 > 综合 > 正文

分别安装nginx, pcre, ssl

2013年12月07日 ⁄ 综合 ⁄ 共 2875字 ⁄ 字号 评论关闭

-----------------------------------------------------------------------------------------------------
--------------分别安装nginx, pcre, ssl

特别说明
我ubuntu上的nginx, 是在pcre, ssl都不make install的情况下才安装成功的

分别步骤为:
1. pcre: 直接解压, mv改名, 放到/usr/local/pcre
2. ssl: 只用第二种方法的no thread..., 然后只make, 后面不选择make install

1. pcre

rm -rf pcre-7.7
tar -zxvf pcre-
7.7.tar.gz
cd pcre-
7.7
./configure --prefix
=/usr/local/pcre
make
make install

2. ssl

第一种方式第二种方式

rm -rf openssl-0.9.8h
rm -rf /usr/local/ssl
tar -zxvf openssl-
0.9.8h.tar.gz

 

cd openssl-0.9.8h
./config
make
make test
make install

 

mv /home/void/openssl-0.9.8h /usr/local/ssl
./config no-threads no-shared
make

 

3. nginx
ps: 一般不用设置 --with-zlib=/usr/include/

rm -rf nginx-0.6.32
tar -zxvf nginx-
0.6.32.tar.gz
cd nginx-
0.6.32
./configure --with-openssl
=/usr/local/ssl/ --with-pcre=/usr/local/pcre/ --with-http_stub_status_module
make
make install

 

编译不过, 请检查pcre, 是否已经make, 可以选择只解压, 不make的方式
--with-http_ssl_module, 加入ssl支持

-----------------------------------------------------------------------------------------------------
--------------优化配置文件

vi proxy.conf
# proxy.conf
proxy_redirect off
;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;

vi /usr/local/nginx/conf/nginx.conf

 

#user  nobody;
worker_processes  1;

#error_log  logs/error.log
;
error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid
;


events {
    use epoll
;
    worker_connections  1024;
}


http {
    include       mime.types
;
    default_type  application/octet-stream;
    include /usr/local/nginx/conf/proxy.conf;

    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  logs/access.log  main
;

    sendfile        on
;
    #tcp_nopush     on;

    #keepalive_timeout  
0;
    keepalive_timeout  65;

    #gzip  on
;

    server {
        listen       
7070;
        server_name  localhost;

        #charset koi8-r
;

        #access_log  logs/host.access.log  main
;
 # serve static files
        location ~ ^/(images|img|pages|javascript|js|css|flash|media|static)/ {
            root  /vosite/www
;
            expires 30d;
        }

        location / {
            root  /vosite/www
;
            index index.html index.jsp index.htm;
            proxy_pass http://localhost:8080;
        }

        location /NginxStatus {
            stub_status on
;
            access_log on;
            auth_basic "NginxStatus";
        }

        #error_page  
404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   
500 502 503 504  /50x.html;
        location = /50x.html {
            root   html
;
        }
}

 

抱歉!评论已关闭.