Nginx installation details, nginx details
I. Environment:
1. Linux: centos6.4 (32-bit)
2. Gcc compiling environment. Use the make command to edit the file.
Yum install gcc-c ++
3. PCRE
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. Therefore, you need to install the pcre Library on linux.
Yum install-y pcre-devel
Note: pcre-devel is a secondary development library developed using pcre. Nginx also needs this library.
4. zlib
The zlib library provides many compression and decompression methods. nginx uses zlib to perform gzip on the http package content. Therefore, you need to install the zlib library on linux.
Yum install-y zlib-devel
5. openssl
OpenSSL is a powerful secure socket-layer cryptographic library that includes major 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 protocol, but also https (Transmission of http over ssl protocol). Therefore, you need to install the openssl library in linux.
Yum install-y openssl-devel
II,
Installation Steps
Step 1: Upload the Nginx installation package to linux.
Step 2: Decompress the package.
[Root @ bogon ~] # Tar-zxf nginx-1.8.0.tar.gz
Step 3: Go to the source code directory.
The parameter settings are as follows:
./Configure \
-- Prefix =/usr/local/nginx \
-- Pid-path =/var/run/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/temp/nginx/client \
-- Http-proxy-temp-path =/var/temp/nginx/proxy \
-- Http-fastcgi-temp-path =/var/temp/nginx/fastcgi \
-- Http-uwsgi-temp-path =/var/temp/nginx/uwsgi \
-- Http-scgi-temp-path =/var/temp/nginx/scgi
Step 4: make
Step 5: make install
Note: Specify the temporary file directory as/var/temp/nginx. Create the temp and nginx directories under/var.
III,
Start and Stop Nginx
There is an executable nginx file under the nginx installation directory (/usr/local/nginx/sbin.
Start: [root @ bogon sbin] #./nginx
Access test: http: // 192.168.25.htm
Close the service:
[Root @ bogon sbin] #./nginx-s stop
Reload the configuration file:
[Root @ bogon sbin] #./nginx-s reload
Disable firewall: [root @ bogon sbin] # service iptables stop