Install nginx in linux
Download a tar.gz version of nginx from the official website.
Install with make
Step 1: Extract
Tar-zxvf nginx-1.7.4.tar.gz
Step 2: Go to the nginx-1.7.4 and run the./configure command
Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[Root @ localhost nginx-1.7.4] #./configure
Checking for OS
+ Linux 2.6.32-431. el6.x86 _ 64 x86_64
Checking for C compiler... not found
./Configure: error: C compiler cc is not found
This error occurs.
The gcc package is not installed. Install gcc, cool.
Yum-y install gcc
Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Execute again./configure
./Configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using -- without-http_rewrite_module
Option, or install the PCRE library into the system, or build the PCRE library
Statically from the source with nginx by using -- with-pcre = <path> option.
Yum install pcre-devel
Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Execute again./configure
./Configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using -- without-http_gzip_module
Option, or install the zlib library into the system, or build the zlib library
Statically from the source with nginx by using -- with-zlib = <path> option.
Yum install zlib-devel
Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Execute again./configure
Configuration summary
+ Using system PCRE library
+ OpenSSL library is not used
+ Using builtin md5 code
+ Sha1 library is not found
+ Using system zlib library
OK. Now you can execute make. If you want to use the openssl function, sha1 function. So install openssl, sha1, cool. Install opensslyum install openssl-devel to install sha1
Yum install perl-Digest-SHA1.x86_64
Enable ssl module execution./configure -- with-http_ssl_module
Enable the server + status page and execute./configure -- with-http_stub_status_module
Start both of them. Execute./configure -- with-http_stub_status_module -- with-http_ssl_module
Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Then configre will pass.
Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Run the make command
Run the make install command.
So far, nginx is successfully executed.
Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Add the following environment variables to/etc/profile: export NGINX_HOME =/usr/local/nginx.
Export PATH = $ PATH: $ NGINX_HOME/sbin save and execute source/etc/profile to make the configuration file take effect. Run nginx-v to view the version. The nginx installation is successful.