PCYO 评测夜鸥 六度计算世界

少年强 则 中国强

nginx标准编译参数

  1. 添加用户和用户组

    groupadd nginx 
    useradd nginx -g nginx -s /sbin/nologin -M 
    mkdir /var/lib/nginx/tmp 
    chown -R nginx:nginx /var/lib/nginx 
  2. 安装一些必备包:

    yum -y install redhat-rpm-config gd-devel libxslt-devel libxml2 libxml2-dev perl-devel perl-ExtUtils-Embed GeoIP-devel.x86_64 libmaxminddb-devel.x86_64 gperftools openssl openssl-devel 
  3. 编译:

    ./configure \ 
    --prefix=/etc/nginx \ 
    --sbin-path=/usr/sbin/nginx \ 
    --modules-path=/usr/lib64/nginx/modules \ 
    --conf-path=/etc/nginx/nginx.conf \ 
    --error-log-path=/var/log/nginx/error.log \ 
    --http-log-path=/var/log/nginx/access.log \ 
    --http-client-body-temp-path=/var/cache/nginx/client_temp \ 
    --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ 
    --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ 
    --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ 
    --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ 
    --pid-path=/var/run/nginx.pid \ 
    --lock-path=/var/run/nginx.lock \ 
    --user=nginx \ 
    --group=nginx \ 
    --with-file-aio \ 
    --with-http_auth_request_module \ 
    --with-http_ssl_module \ 
    --with-http_v2_module \ 
    --with-http_realip_module \ 
    --with-http_addition_module \ 
    --with-http_dav_module \ 
    --with-http_flv_module \ 
    --with-http_mp4_module \ 
    --with-http_gunzip_module \ 
    --with-http_gzip_static_module \ 
    --with-http_random_index_module \ 
    --with-http_secure_link_module \ 
    --with-http_slice_module \ 
    --with-http_stub_status_module \ 
    --with-mail \ 
    --with-mail_ssl_module \ 
    --with-stream \ 
    --with-stream_ssl_module \ 
    --with-stream_realip_module \ 
    --with-stream_ssl_preread_module \ 
    --with-http_sub_module \ 
    --with-threads \ 
    --with-compat \ 
    --with-pcre \ 
    --with-pcre-jit \ 
    --with-http_perl_module=dynamic \ 
    --with-http_degradation_module \ 
    --with-google_perftools_module \ 
    --with-debug \ 
    --with-http_xslt_module=dynamic \ 
    --with-http_image_filter_module=dynamic \ 
    --add-dynamic-module=/root/ngx_http_geoip2_module-master \ 
    --with-http_geoip_module=dynamic --with-stream_geoip_module=dynamic \ 
    --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' \ 
    --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' 
  4. make && install
  5. enjoy!
本原创文章未经允许不得转载 | 当前页面:PCYO 评测夜鸥 六度计算世界 » nginx标准编译参数

评论