how-to-install-nginx-on-centos6.6-x86_64
1 install
方式1 install from prebuild rpm
1)
vi /etc/yum.repos.d/
vi nginx-inet.repo
#[nginx]
#name=nginx repo
#baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
#gpgcheck=0
#enabled=1
Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “5”, “6”, or “7”, for 5.x, 6.x, or 7.x versions, respectively.
示例:For centos6
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
yum makecache
yum list nginx
yum install -y nginx.x86_64
方式2 install from source
Building nginx from Sources
Example of parameters usage (all of this needs to be typed in one line):
./configure
or
./configure
–sbin-path=/usr/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid
–with-http_ssl_module
–with-pcre=../pcre-4.4
–with-zlib=../zlib-1.1.3 make make install
Note:
ngnix 依赖 pcre + openssl
最简单的方法是
yum install -y pcre-devel openssl-devel
示例:
download nginx
cd /docker_vol01/soft/web
tar zxf nginx-1.6.2.tar.gz
cd nginx-1.6.2
安装依赖
yum list pcre-devel
yum install -y pcre-devel.x86_64
yum list openssl-devel
yum install -y openssl-devel.x86_64
./configure –prefix=/opt/nginx-1.6.2-bin –with-http_ssl_module
make
make install
2启停
1)start
sbin/ngnix
2)check
vi check
ps -ef|grep nginx|grep -v grep
sh check
3)stop
[root@monitor1 nginx-1.6.2-bin]# sbin/nginx -h
nginx version: nginx/1.6.2
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /opt/nginx-1.6.2-bin/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file
[root@monitor1 nginx-1.6.2-bin]#
sbin/nginx -s stop