Install Nginx through source code compilation
The compilation process is configured using the configure command. This defines various aspects of the system, including the number of processes allowed by nginx. A Makefile is created. The configure command supports the following parameters.
-- Prefix = path defines the directory for saving server files. This directory page is used to set the relative path through configure and nginx. conf. The/usr/local/nginx directory is set by default.
-- Sbin-path = path: Set The Name Of The nginx executable file. This name will only be used during installation. The default file name is prefix/sbin/nginx.
-- Conf-path = path: Set The Name Of The nginx. conf configuration file. If needed, nginx can use-c file to specify a different configuration file. The default file name is prefix/conf/nginx. conf.
-- Pid-path = path: Set The Name Of The nginx. pid file and store the ID of the main process. After installation, the file name can be set in the nginx. conf file. The default file name is prefix/logs/nginx. pid.
-- Error-log-path = path: the file for Setting errors, warnings, and diagnostics. After installation, the file name can be changed through the error_log command in the nginx. conf file. The default file name is prefix/logs/error. log.
-- Http-log-path = path: Set the name of the log file requested by the HTTP server. After installation, the name can be changed using the access_log command in the nginx. conf file. The default file name is prefix/logs/access. log.
-- User = name: Set the non-privileged user of the worker process. After installation, you can use the user command in the nginx. conf file to change it. The default user name is nobody.
-- Group = name: Set the worker Process group. After installation, you can use nginx. In the conf file, use the user command to change the value. The default group name is set to a non-privileged user name.
With-select_module
-- The without-select_module allows or disables the compilation server from working using the select () method. If no proper method is found on the platform, such as kqueue, epoll, or/dev/poll, this module will be automatically compiled.
With-poll_module
-- The without-poll_module allows or disables servers from working in poll () mode. If there is no suitable method on the platform such as kqueue, epoll or/dev/poll, this module will automatically compile.
-- The without-http_gzip_module prohibits compilation of modules that compress HTTP server replies. To compile and run such a module, you must support the zlib library.
-- The without-http_rewrite_module disables compilation of modules for HTTP redirect requests. To compile this module, the PCRE Library must be prepared in advance.
-- Without-httpd_proxy_module disables compilation of HTTP server proxy Module
-- The with-http_ssl_module allows compilation of modules that support the HTTPS protocol. No compilation is performed by default. The OpenSSL library is required to compile and run this module.
-- With-pcre = path: Specifies the path of the PCRE source code. This library needs to be downloaded from the PCRE website. This library needs to be supported by the regular expression localtion command. And ngx_http_rewrite_module.
-- With-zlib = path: sets the source location of the zlib library. This library needs to be downloaded from the official website and relies on the http_gzip module.
-With-ld-opt = parameters
Case:
./Configure
-- Sbin-path =/usr/local/nginx \
-- Conf-path =/usr/local/nginx. conf \
-- Pid-path =/usr/local/nginx. pid \
With-http_ssl_module \
-- With-pcre = ../pcre-4.4 \
-- With-zlib = ../zlib-1.1.3
After configuration, nginx can be compiled and installed using make.
The build is configured using the configure command. it defines various aspects of the system, including the methods nginx isallowed to use for connection processing. at the end it creates aMakefile. the configure commandsupports the following parameters:
-- Prefix = path-defines a directorythat will keep server files. this same directory will also be used for allrelative paths set by configure (could t for paths to librariessources) and in the nginx. conf configuration file. it is set to the/usr/local/nginx directoryby default.
-- Sbin-path = path-sets the name of annginx executable file. This name is used only during installation. By defaultthe file is named prefix/sbin/nginx.
-- Conf-path = path-sets the name of an nginx. conf configurationfile. if needs be, nginx can always be started with a different configurationfile, by specifying it in the command-line parameter-c file. bydefault the file is named prefix/conf/nginx. conf.
-- Pid-path = path-sets the name of annginx. pid file that will store the process ID of the main process. afterinstallation, the file name can always be changed in the nginx. confconfigurationfile using the pid directive. by default the file is named prefix/logs/nginx. pid.
-- Error-log-path = path-sets the nameof the primary error, warnings, and diagnostic file. after installation, thefile name can always be changed in the nginx. conf configuration fileusing the error_log directive. by default the file is named prefix/logs/error. log.
-- Http-log-path = path-sets the nameof the primary request log file of the HTTP server. after installation, thefile name can always be changed in the nginx. conf configuration fileusing the access_log directive. by default the file is named prefix/logs/access. log.
-- User = name-sets the name of anunprivileged user whose credentials will be used by worker processes. afterinstallation, the name can always be changed in the nginx. conf configurationfile using the user directive. the default user name is nobody.
-- Group = name-sets the name of agroup whose credentials will be used by worker processes. after installation, the name can always be changed in the nginx. conf configuration fileusing the user directive. by default, a group name is set to the name of an unprivileged user.
With-select_module
-- Without-select_module-enables or disables building a module thatallows the server to work with the select () method. this module isbuilt automatically if the platform does not appear to support more appropriatemethods such as kqueue, epoll, or/dev/poll.
With-poll_module
-- Without-poll_module-enables or disables building a module that allowsthe server to work with the poll () method. this module is builtautomatically if the platform does not appear to support more appropriatemethods such as kqueue, epoll, or/dev/poll.
-- Without-http_gzip_module-disablesbuilding a module that compressesresponses of an HTTP server. The zlib library is required tobuild and run this module.
-- Without-http_rewrite_module-disables building a module that allows an HTTP server toredirectrequests and change URI of requests. The PCRE library is required tobuild and run this module.
-- Without-http_proxy_module-disablesbuilding an HTTP server proxyingmodule.
-- With-http_ssl_module-enablesbuilding a module that adds the HTTPSprotocol support to an HTTP server. This module is not built bydefault. The OpenSSL library is required to build and run this module.
-- With-pcre = path-sets the path tothe sources of the PCRE library. the library distribution (version 4.4-8.32) needs to be downloaded from the PCRE siteand extracted. the rest is done by nginx's. /configure and make. the library is required for regular expressions support in the location directiveand for the ngx_http_rewrite_module.
-- With-pcre-jit-builds the PCRElibrary with "just-in-time compilation" support (1.1.12, the pcre_jit directive ).
-- With-zlib = path-sets the path tothe sources of the zlib library. the library distribution (version 1.1.3-1.2.7) needs to be downloaded from the zlib siteand extracted. the rest is done by nginx's. /configure and make. the library is required for the ngx_http_gzip_modulemodule.
-- With-cc-opt = parameters-setsadditional parameters that will be added to the CFLAGS variable. when using thesystem PCRE library under FreeBSD, -- with-cc-opt = "-I/usr/local/include" shocould be specified. if the number of files supportedby select () needs to be increased it can also be specified here suchas this: -- with-cc-opt = "-D FD_SETSIZE = 2048 ".
-- With-ld-opt = parameters-setsadditional parameters that will be used during linking. when using the systemPCRE library under FreeBSD, -- with-ld-opt = "-L/usr/local/lib" shouldbe specified.
Example of parameters usage (all of thisneeds to be typed in one line ):
./Configure
-- Sbin-path =/usr/local/nginx
-- Conf-path =/usr/local/nginx. conf
-- Pid-path =/usr/local/nginx. pid
With-http_ssl_module
-- With-pcre = ../pcre-4.4
-- With-zlib = ../zlib-1.1.3
After configuration, nginx is compiled andinstalled using make.
Deployment of Nginx + MySQL + PHP in CentOS 6.2
Build a WEB server using Nginx
Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5
Performance Tuning for Nginx in CentOS 6.3
Configure Nginx to load the ngx_pagespeed module in CentOS 6.3
Install and configure Nginx + Pcre + php-fpm in CentOS 6.4
Nginx installation and configuration instructions
Nginx log filtering using ngx_log_if does not record specific logs
Nginx details: click here
Nginx: click here
This article permanently updates the link address: