Linux Compiler installation Nginx
background:
Learn Nginx before you need to install Nginx, here record how to compile the installation Nginx, for later review use.
PS: There is no special need, it is best to use Yum installation, Yum installation need to match Epel Yum source.
Official Yum Source Address:
Http://nginx.org/packages/centos/6/x86_64/RPMS
Fedora-epel:
https://mirrors.aliyun.com/epel/6/x86_64/
Choose 6 or 7 depending on the large version, or other.
Installation:
1. Prepare Nginx Source Package
Official: http://nginx.org/en/download.html
2, pre-compilation preparation work
1) Install the development pack Group
Yum-y Groupinstall "Development tools"
2) Install the development packages needed for compilation (these packages will not be installed when the development Pack group is installed):
Yum Install Pcre-devel openssl-devel zlib-devel
3) Unzip the source package
Tar xvf nginx-1.10.3.tar.gz
4) CD into the decompression directory
CD nginx-1.10.3
5) Prepare Nginx users and user groups
Useradd-r Nginx
3. Start compiling the installation
1)./configure--prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf-- Error-log-path=/var/log/nginx/error.log--http-log-path=/var/log/nginx/access.log--pid-path=/var/run/nginx.pid- -lock-path=/var/run/nginx.lock--user=nginx--group=nginx--with-http_ssl_module--with-http_v2_module--with-http_ Dav_module--with-http_stub_status_module--with-threads--with-file-aio
Compile and install Nginx options:
--prefix=/etc/nginx Installation Path
--sbin-path=/usr/sbin/nginx indicate nginx program file installation path
--CONF-PATH=/ETC/NGINX/NGINX.CONF Master Profile Installation Location
--error-log-path=/var/log/nginx/error.log error log file installation location
--http-log-path=/var/log/nginx/access.log Access log File installation location
--pid-path=/var/run/nginx.pid indicates the PID file installation location
--lock-path=/var/run/nginx.lock Lock File Installation location
--http-client-body-temppath=/var/cache/nginx/client_temp the temporary file storage path of the body part of the client, if the server allows the client to submit large data using the Put method, the disk path that is temporarily stored
--http-proxy-temp-path=/var/cache/nginx/proxy_temp as a proxy server, the server response message temporary file storage path
--http-fastcgi-temppath=/var/cache/nginx/fastcgi_temp as the FASTCGI proxy server, the server response message temporary file storage path
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp as the UWSGI proxy server, the server response message temporary file storage path
--http-scgi-temp-path=/var/cache/nginx/scgi_temp as a scgi server, a temporary file storage path for server response messages
--user=nginx indicates that the worker process is running in that identity, and the master master process is typically run by root
--group=nginx
--with-http_ssl_module means to compile the specified module in
2) Make && make install
4, Nginx use
Ls/usr/local/nginx/html is the test page, Sbin is the main program
Ls/usr/local/nginx/sbin/nginx only one program file
ls/usr/local/nginx/html/50x.html index.html Test Web page
Nginx: Default to start Nginx
-H View Help options
-T test nginx syntax error
-c filename Specifies the configuration file (default:/etc/nginx/nginx.conf)
-s signal sends a signal to the master process, signal can be: Stop, Quit,reopen, reload
Example:
Nginx
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/29/e051ef433b2c3861abe5f31aedc32aca.png "title=" 1.png " alt= "E051ef433b2c3861abe5f31aedc32aca.png"/>
Nginx-s Stop Stop
Nginx-s Reload Reload configuration file
NGINX-G directives indicates the global directive on the command line
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/29/d24f1ef0b3fc7707a53d36fde9bdde26.png "title=" 2.png " alt= "D24f1ef0b3fc7707a53d36fde9bdde26.png"/>
Linux Compiler Installation Nginx