Nginx is generally recommended to install to a Linux system, and to install the C language compilation environment GCC
* Download Nginx
Enter http://nginx.org/en/download.html download Nginx (take 1.8 for example)
* install Nginx-dependent packages First:
1, the installation of nginx need to first download the source code to compile, compiled dependent on the GCC environment, if there is no GCC environment, need to install Gcc:yum install gcc-c++
The 2,nginx HTTP module uses PCRE to parse the regular expression, so you need to install the Pcre library on Linux: yuminstall-y pcre pcre-devel
The 3,zlib library provides a number of ways to compress and decompress, Nginx uses zlib to gzip the contents of the HTTP package, so you need to install the Zlib library on Linux:yuminstall-y zlib zlib-devel
4,nginx not only supports the HTTP protocol, it also supports HTTPS (that is, transmitting HTTP on the SSL protocol), so you need to install the OpenSSL library on Linux:yuminstall-y OpenSSL Openssl-devel
* Installation Steps
The first step: Upload the Nginx source code to the Linux system (you can use the tool or use alt+p)
Step two: Unzip the package.
Step three: Carry out configure. (The red part is the Nginx installation directory)
./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/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
Note: The temp file directory above is specified as /var/temp/nginx , you need to / var under Create Temp and Nginx If the catalog is not available, Nginx will error when booting.
Fourth step: Make
Fifth Step: Makeinstall
*nginx start-up, stop
1, start: Enter Nginx sbin directory,./nginx can be started. (To see if two processes are started)
having master and worker two processes indicates a successful start,
No access to see if the firewall is off
2, stop: Enter Nginx sbin directory can use the kill+ process command, but is not recommended to use :./nginx-s Stop
Configuration of the *nginx
In the/usr/local/nginx/conf directory, the nginx.conf file is nginx configuration file
The above describes the installation and configuration of Nginx, including nginx aspects of the content, I hope the PHP tutorial interested in a friend helpful.