nginx--tengine源码安装

安装依赖包 yum install -y gcc gcc-c++ ncurses-devel perl pcre pcre-devel openssl openssl-devel zlib
[root@nginx ~]# useradd nginx -s /sbin/nologin
[root@nginx opt]# tar zxf pcre-8.34.tar.gz
[root@nginx opt]# cd pcre-8.34
[root@nginx pcre-8.34]# ./configure
[root@nginx pcre-8.34]# make && make install
[root@nginx opt]# tar zxf tengine-1.5.1.tar.gz
[root@nginx opt]# cd tengine-1.5.1
[root@nginx tengine-1.5.1]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
[root@nginx tengine-1.5.1]# make && make install
(1)修改配置文件
[root@nginx ~]# mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
[root@nginx ~]# vi /usr/local/nginx/conf/nginx.conf
添加以下配置
user nginx nginx;
worker_processes auto;
worker_rlimit_nofile 65535;
error_log /var/log/www/error.log;
#pid      logs/nginx.pid;
events {
    use epoll;
    worker_connections  51200;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
  log_format  main  '$remote_addr - $remote_user [$time_local] "$request"'
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';


    server_info  off;
    server_tag   off;
    server_name_in_redirect off;
    access_log  /var/log/www/access.log  main;
    client_max_body_size 20m;
    client_header_buffer_size 16k;
    large_client_header_buffers 4 16k;
    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  65;
    server_tokens on;
    gzip  on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_proxied   any;
    gzip_http_version 1.1;
    gzip_comp_level 3;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;
    upstream www {
consistent_hash $request_uri;
  #ip_hash;
       server 192.168.1.242:8080;
       server 192.168.1.243:8080;
    }
    server {
        listen       80;
        server_name  localhost;
        location / {
      root   html;
      index  index.html index.htm;
      proxy_pass   http://www;
      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_buffer_size   4k;
      proxy_buffers   4 32k;
      proxy_busy_buffers_size   64k;
      proxy_temp_file_write_size  64k;
   }
  }
 }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值