CentOS6.5 install Nginx1.10.2
Download the latest version 1.10.2 from the official website
Nginx-1.10.2.tar.gz
Install Nginx dependency package
- GCC
Nginx is developed in C language.
# yum install gcc-c++
- PCRE (Perl Compatible Regular Expressions) is a Perl library, including a perl-Compatible Regular Expression Library. The http module of nginx uses pcre to parse regular expressions.
# yum install -y pcre pcre-devel
- The zlib library provides many compression and decompression methods. Nginx uses zlib to perform gzip on the http package content.
# yum install -y zlib zlib-devel
- Openssl OpenSSL is a powerful Secure Socket Layer cryptographic library, which includes the main cryptographic algorithms, common keys, certificate encapsulation management functions, and SSL protocols, and provides a wide range of applications for testing or other purposes. Nginx not only supports http, but also supports https (that is, transmission of http over ssl ).
# yum install -y openssl openssl-devel
Install
# tar zxvf nginx-1.10.2.tar.gz
- Use the configure command to configure attributes before compilation.
# cd nginx-1.10.2# ./configure \--prefix=/usr/local/nginx \--pid-path=/var/run/nginx/nginx.pid \--lock-path=/var/lock/nginx.lock \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--with-http_gzip_static_module \--http-client-body-temp-path=/var/tmp/nginx/client \--http-proxy-temp-path=/var/tmp/nginx/proxy \--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \--http-scgi-temp-path=/var/tmp/nginx/scgi
# cd /var/tmp/# mkdir nginx
- Switch back to the nginx-1.10.2 directory
# cd /root/Downloads/nginx-1.10.2
- Compile (A Makefile file is generated by using the configure command)
# make
# make install
Start
- Go to the Nginx installation directory
# cd /usr/local/nginx/
- Enter the program execution directory
# cd sbin
#./Nginx // start #./nginx-s stop // stop #./nginx-s reload // re-read the configuration
- You can check whether the startup is successful through http: // ip