"personal records, there must be a misunderstanding and understanding of the place, small white always has a growing process, I hope you have a lot of advice." "
First, the preparatory work: 1. Install the necessary tools:
$ yum-y Install gcc gcc-c++ autoconf automake$ yum-y install zlib zlib-devel OpenSSL openssl-devel pcre-devel
Description
Pcre: The function used for address rewriting.
Zlib:nginx's gzip module, which transmits data packaging, saves traffic (but consumes resources).
OpenSSL: Provides SSL encryption protocol.
2. Create a new system-level user group and anonymous user, and use the following compile-time
$ sudo groupadd-r nginx-group$ sudo useradd-s/sbin/nologin-g nginx-group-r nginx-user
Second, Nginx compiled installation:1. Download nginx:http://nginx.org/en/download.html2, unzip the compilation:
$ tar-zxvf nginx-1.9.2.tar.gz$ cd nginx-1.9.2/$./configure--prefix=/usr--sbin-path=/usr/sbin/nginx--conf-path=/etc /nginx/nginx.conf--error-log-path=/var/log/nginx/error.log--pid-path=/var/run/nginx/nginx.pid--lock-path=/var/ Lock/nginx.lock--user=nginx-user--group=nginx-group--with-http_ssl_module--with-http_flv_module--with-http_ Gzip_static_module--http-log-path=/var/log/nginx/http.log--http-client-body-temp-path=/var/tmp/nginx/client-- Http-proxy-temp-path=/var/tmp/nginx/proxy--http-fastcgi-temp-path=/var/tmp/nginx/fcgi--with-http_stub_status_ Module
The function of the above parameters can be viewed by--help
$./configure--help
Compile log:
Checking for OS + Linux 3.10.0-229.4.2.el7.x86_64 x86_64checking for C compiler ... found + using GNU C compiler + GCC ver sion:4.8.3 20140911 (Red Hat 4.8.3-9) (gcc) checking for gcc-pipe switch ... foundchecking for GCC Builtin Atomic Operat Ions ... foundchecking for C99 variadic macros ... foundchecking for GCC variadic macros ... foundchecking for unistd.h ... . Foundchecking for inttypes.h ... foundchecking for limits.h ... foundchecking for sys/filio.h ... not foundchecking for Sy S/param.h ... foundchecking for sys/mount.h ... foundchecking for sys/statvfs.h ... foundchecking for crypt.h ... Foundche cking for Linux specific featureschecking for epoll ... foundchecking for epollrdhup ... foundchecking for o_path ... Foun Dchecking for Sendfile () ... foundchecking for sendfile64 () ... foundchecking for sys/prctl.h ... foundchecking for Prctl ( pr_set_dumpable) ... foundchecking for sched_setaffinity () ... foundchecking for Crypt_r () ... foundchecking for sys/vfs.h ... foundchecking for Poll () ... foundchecking for/dev/poll ... not foundchecking for kqueue ... not foundchecking for crypt () ... not foundch Ecking for Crypt () in Libcrypt ... foundchecking for f_readahead ... not foundchecking for posix_fadvise () ... Foundchecki ng for O_direct ... foundchecking for f_nocache ... not foundchecking for directio () ... not foundchecking for Statfs (): . Foundchecking for Statvfs () ... foundchecking for Dlopen () ... not foundchecking for Dlopen () in libdl ... foundchecking f or Sched_yield () ... foundchecking for so_setfib ... not foundchecking for so_reuseport ... foundchecking for So_acceptfil TER ... not foundchecking for tcp_defer_accept ... foundchecking for tcp_keepidle ... foundchecking for tcp_fastopen ... n OT foundchecking for tcp_info ... foundchecking for Accept4 () ... foundchecking for eventfd () ... foundchecking for int si Ze ... 4 byteschecking for long size ... 8 byteschecking for long long size ... 8 byteschecking for void * Size ... 8 byteschecking for uint64_t ... foundchecking for sig_atomic_t ... foundchecking for sig_atomic_t size ... 4 byteschecking for socklen_t ... foundchecking for in_addr_t ... foundchecking for in_port_t ... foundchecking for rlim_t ... foundchecking for uintptr_t ... uintptr_t foundchecking for system byte ordering ... little endianchecking for size_t Size ... 8 byteschecking for off_t size ... 8 byteschecking for time_t size ... 8 byteschecking for Setproctitle () ... not foundchecking for pread () ... foundchecking for Pwrite () ... foundchecking for Sys_nerr ... foundchecking for Localtime_r () ... foundchecking for posix_memalign () ... foundchecking for memalign () ... f Oundchecking for Mmap (map_anon| map_shared) ... foundchecking for mmap ("/dev/zero", map_shared) ... foundchecking for System V SHARED memory ... foundchec King for POSIX semaphores ... not foundchecking for POSIX semaphores in libpthread ... foundchecking for struct msghdr.msg _control ... foundchecking for IOCTL (FIONBIO) ... foundchecking for struct tM.tm_gmtoff ... foundchecking for struct dirent.d_namlen ... not foundchecking for struct dirent.d_type ... foundchecking For sysconf (_SC_NPROCESSORS_ONLN) ... foundchecking for Openat (), Fstatat () ... foundchecking for getaddrinfo () ... Foundc Hecking for PCRE Library ... foundchecking for PCRE JIT-support ... foundchecking for OpenSSL library ... foundchecking fo R zlib Library ... foundcreating objs/makefileconfiguration summary + using System PCRE Library + using System OpenSSL L Ibrary + md5:using OpenSSL library + sha1:using OpenSSL library + using System zlib library nginx Path prefix: "/usr "Nginx binary file:"/usr/sbin/nginx "nginx configuration prefix:"/etc/nginx "Nginx configuration file:"/etc/nginx/n ginx.conf "nginx pid file:"/var/run/nginx/nginx.pid "nginx error log file:"/var/log/nginx/error.log "Nginx http acces S log file: "/var/log/nginx/http.log" nginx HTTP client request body Temporary files: "/var/tmp/nginx/client" Nginx http Proxy Temporary files:"/var/tmp/nginx/proxy" Nginx http fastcgi temporary files: "/var/tmp/nginx/fcgi" Nginx http uwsgi temporary files: "UWSG I_temp "Nginx http scgi temporary files:" Scgi_temp "
It seems to be a success.
3. Installation:
$ make && make install
4. Start:
$ nginx
If you are missing a package, install it directly with Yum
$ yum Install xxxxx
If prompted:
nginx: [Emerg] mkdir () "/var/tmp/nginx/client" failed (2:no such file or directory)
Then use the administrator to mkdir the folder before starting.
CentOS 7 Installation Nginx-1.9.2