how-to-install-nginx-on-centos6.6-x86_64

how-to-install-nginx-on-centos6.6-x86_64

1 install

方式1 install from prebuild rpm

nginx: Linux packages dowload

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


3 configuration

参考Beginner’s Guide

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值