zoukankan      html  css  js  c++  java
  • nginx 安装配置+清缓存模块安装

    经过一段时间的使用,发现 nginx 在并发与负载能力方面确实优于 apache,现在已经将大部分站点从 apache 转到
    了 nginx 了。以下是 nginx 的一些简单的安装配置。
    环境
    操作系统: CentOS、 RedHat
    IP 地址: 192.168.1.202
    下载软件包
    # mkdir /usr/local/src/tarbag
    # mkdir /usr/local/src/software
    # cd /usr/local/src/tarbag/
    Nginx
    # wget http://www.nginx.org/download/nginx-1.0.6.tar.gz
    Nginx cache purge 模块(可选)
    # wget http://labs.frickle.com/files/ngx_cache_purge-1.3.tar.gz
    编译安装
    # cd /usr/local/src/tarbag/
    # tar -xzvf nginx-1.0.6.tar.gz -C /usr/local/src/software
    # tar -xzvf ngx_cache_purge-1.3.tar.gz -C /usr/local/src/software
    # cd /usr/local/src/software/
    # ./configure
    –prefix=/usr/local/nginx-1.0.6 # 安装路径

    –with-http_stub_status_module # 启用 nginx 状态模块
    –with-http_ssl_module # 启用 SSL 模块
    –with-http_realip_module # 启用 realip 模块(将用户 IP 转发给后端服务器)
    –add-module=../ngx_cache_purge-1.3 # 添加缓存清除扩展模块
    # make
    # make install

    内核参数优化
    # vi sysctl.conf 增加以下配置
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 1800
    net.ipv4.ip_conntrack_max = 16777216 # 如果使用默认参数,容易出现网络丢包
    net.ipv4.netfilter.ip_conntrack_max = 16777216# 如果使用默认参数,容易出现网络丢包
    net.ipv4.tcp_max_syn_backlog = 65536
    net.core.netdev_max_backlog = 32768
    net.core.somaxconn = 32768
    net.core.wmem_default = 8388608
    net.core.rmem_default = 8388608
    net.core.rmem_max = 16777216
    net.core.wmem_max = 16777216
    net.ipv4.tcp_timestamps = 0
    net.ipv4.tcp_synack_retries = 2
    net.ipv4.tcp_syn_retries =
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_tw_reuse = 1
    net.ipv4.tcp_mem = 94500000 915000000 927000000
    net.ipv4.tcp_max_orphans = 3276800
    net.ipv4.ip_local_port_range = 1024 65535
    配置生效
    # sysctl –p
    修改 iptables 启动脚本,在 star()函数里面加上
    # vi /etc/init.d/iptables
    /sbin/sysctl -p

  • 相关阅读:
    C#如何通过NCO3.0来连接SAP并调用SAP中的RFC
    .Net连接到SAP【转载】
    将博客搬至CSDN
    Apache Flume 简介
    日志收集以及分析:Splunk
    《淘宝技术这十年》读后感
    python参考手册--第9章
    Hadoop将过时了?
    pythn BeautifulSoup
    Python性能鸡汤
  • 原文地址:https://www.cnblogs.com/mmdln/p/8949551.html
Copyright © 2011-2022 走看看