Sorted out from the Internet: cent os6.5 64-bit method of installing ngnix.
Environment preparation:
yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl openssl –devel pcre
pcre-devel
Download nginx
wget http://nginx.org/download/nginx-1.0.2.tar.gz
Unzip
tar ?xzvf nginx-1.0.2.tar.gz
cd nginx-1.0.2
./configure
configure supports the following options:
–prefix= – Nginx installation path. If not specified, defaults to
/usr/local/nginx.
–sbin-path= –
Nginx executable file installation path. It can only be specified during installation, if not specified, the default is /sbin/nginx.
–conf-path= –
The path to the default nginx.conf when no -c option is given. If not specified, defaults to /conf/nginx.conf.
–pid-path= –
The path of the default nginx.pid when no pid directive is specified in nginx.conf. If not specified, defaults to
/logs/nginx.pid.
–lock-path= – Path to nginx.lock file.
–error-log-path= –
The path to the default error log if no error_log directive is specified in nginx.conf. If not specified, defaults to
/logs/error.log.
–http-log-path= –
The default access log path when no access_log directive is specified in nginx.conf. If not specified, defaults to
/logs/access.log.
–user= –
In the case that no user directive is specified in nginx.conf, the default user used by nginx. If not specified, defaults to nobody.
–group= –
The default group used by nginx when no user directive is specified in nginx.conf. If not specified, defaults to nobody.
–builddir=DIR – specify build directory
–with-rtsig_module – enable rtsig module
Install at last
make && make install
Start service:
Can be written as a script:
#!/bin/bash
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
exit 0
Check if the process is started:
ps -ef | grep nginx
Check whether the port is occupied
netstat -anp | grep 8080 View the specified port
Enter IP:PORT
in the browser
Welcome to nginx!
Possible problems: Is the firewall closed iptables and selinux
************************************** ***
When installing red hat 6.2 64bit, the following error will occur:
./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= option.
The solution is to download the regular expression dependency library of the Rewrite module: pcre
The choice is: pcre-8.02.tar.gz
Address: http://sourceforge.net/projects/pcre/?source=dlp
tar -zxvf pcre-8.02.tar.gz
cd pcre-8.02
./configure
make
make install
Execute ./configure under nginx after completion