Nginx编译安装

CentOS 下tarball安装nginx步骤

  • 添加nginx以及php-fpm进程属主,第一条命令如果在安装php时已运行则跳过
    # useradd -M -s /bin/false www
    # useradd -G www -M -s /bin/false nginx

  • 创建相关目录
    # mkdir -p /tmp/nginx/proxy /tmp/nginx/fcgi /tmp/nginx/client  /tmp/nginx/cache
    # chown nginx:nginx /tmp/nginx/ -R
    # mkdir /var/log/nginx

  • 配置编译参数,可根据需要开关模块
    # ./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf \
      --sbin-path=/usr/local/sbin/nginx --user=nginx --group=www \
      --with-http_ssl_module --with-http_realip_module  \
      --with-http_stub_status_module \
      --with-file-aio \
      --pid-path=/var/run/nginx.pid \
      --lock-path=/tmp/nginx/nginx.lock \
      --http-log-path=/var/log/nginx/access.log \
      --error-log-path=/var/log/nginx/error.log \
      --http-client-body-temp-path=/tmp/nginx/client \
      --http-proxy-temp-path=/tmp/nginx/proxy \
      --http-fastcgi-temp-path=/tmp/nginx/fcgi \
      --with-debug \
      --without-http_ssi_module \
      --without-http_scgi_module \
      --without-http_uwsgi_module \
      --without-http_autoindex_module \
      --without-http_memcached_module \
      --without-http_proxy_module \
      --without-http_map_module \
      --without-http_geo_module \
      --without-http_auth_basic_module \
      --without-http_upstream_ip_hash_module \
      --without-http_split_clients_module \
      --without-select_module \
    编译结果:
    Configuration summary
      + using system PCRE library
      + using system OpenSSL library
      + md5: using OpenSSL library
      + sha1 library is not used
      + using system zlib library
    
      nginx path prefix: "/usr/local/nginx"
      nginx binary file: "/usr/local/sbin/nginx"
      nginx configuration prefix: "/etc/nginx"
      nginx configuration file: "/etc/nginx/nginx.conf"
      nginx pid file: "/var/run/nginx.pid"
      nginx error log file: "/var/log/nginx/error.log"
      nginx http access log file: "/var/log/nginx/access.log"
      nginx http client request body temporary files: "/tmp/nginx/client"
      nginx http fastcgi temporary files: "/tmp/nginx/fcgi"


  • 安装
    # make install

 

 

你可能感兴趣的:(Nginx编译安装)