编译安装Ningx1.10.2
2017-11-13 本文已影响0人
i36X
1. 下载nginx、pcre、zlib、openssl
# wget http://nginx.org/download/nginx-1.10.2.tar.gz
# wget https://ftp.pcre.org/pub/pcre/pcre-8.38.tar.gz
# wget https://ncu.dl.sourceforge.net/project/libpng/zlib/1.2.10/zlib-1.2.10.tar.gz
# wget http://distfiles.macports.org/openssl/openssl-1.0.2h.tar.gz
2. 解压*.tar.gz文件
# tar -zxvf <file_name>.tar.gz
3. 编译、安装、启动
# ./configure --prefix=/usr/local/nginx --with-pcre=/root/softs/pcre-8.38 --with-zlib=/root/softs/zlib-1.2.10 --with-openssl=/root/softs/openssl-1.0.2h
# make && make install
# nginx
4.配置nginx(已有nginx用户和组的情况下)
# cd /usr/local/nginx
# mkdir -p /usr/local/nginx/conf/conf.d
# vim conf/nginx.conf
---------------------------------
user nginx;
worker_processes auto;
error_log /data/log/nginx/error.log;
pid /var/run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
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 /data/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /usr/local/nginx/conf/mime.types;
default_type application/octet-stream;
include /usr/local/nginx/conf.d/*.conf;
}