Solve the HTTP rewrite module requires the PCRE library.
Installation Process
Download the nginxpackage (or wgethttp: // nginx.org/download/nginx-1.9.15.tar.gz) from http://nginx.org/download/nginx-1.9.15.tar.gzdirectly on the linux System)
Decompress the package and go to the directory.
tar -zxvf nginx-1.9.15.tar.gzcd nginx-1.9.15
Set Configuration Information./configure --prefix=/usr/local/nginx
Or do not execute this step.
Compile and install
makemake install
Make processes convert source code files written in various languages into executable files and various library files. make install copies the compiled executable files and library files to appropriate places.
Possible Errors
- In the configuration information
./configure --prefix=/usr/local/nginx
Error:
/configure: error: the HTTP rewrite module requires the PCRE library.
Solution: Install pcre
yum -y install pcre pcre-devel
-Y: Skip all steps that require manual confirmation.
- The ssl error is missing. The error message is as follows:
./configure: error: the HTTP cache module requires md5 functionsfrom OpenSSL library. You can either disable the module by using--without-http-cache option, or install the OpenSSL library into the system,or build the OpenSSL library statically from the source with nginx by using--with-http_ssl_module --with-openssl=<path> options.
Solution: Install openssl
yum -y install openssl openssl-devel
- The compiler is missing. The error message is as follows:
./configure: error: C compiler cc is not found
Solution: Install gcc-c ++
yum -y install gcc-c++ autoconf automake
Autoconf is configured automatically, and automake is compiled automatically.
- The zlib package is missing. The error message is as follows:
./configure: error: the HTTP gzip module requires the zlib library.You can either disable the module by using –without-http_gzip_moduleoption, or install the zlib library into the system, or build the zliblibrarystatically from the source with nginx by using –with-zlib=<path> option.
Solution: Install zlib
yum install -y zlib-devel
After the installation is complete, start the installation successfully, and the/usr/local/nginx directory is as follows:
fastcgi.conf koi-win nginx.conf.defaultfastcgi.conf.default logs scgi_paramsfastcgi_params mime.types scgi_params.defaultfastcgi_params.default mime.types.default uwsgi_paramshtml nginx uwsgi_params.defaultkoi-utf nginx.conf win-utf
Start
Ensure that port 80 of the system is not occupied by other programs. Run the/usr/local/nginx command to start Nginx,
netstat -ano|grep 80
If no result is found, run the command. If no result is found, ignore this step. (sudo must be enabled in ubuntu; otherwise, it can only run on the foreground)
sudo /usr/local/nginx/nginx
Open the browser to access the IP address of this machine. If the browser displays Welcome to nginx! Nginx has been installed and runs successfully.