安装
- 安装make:
yum -y install gcc automake autoconf libtool make
- 安装g++:
yum install gcc gcc-c++
- 安装openssl
yum -y install openssl openssl-devel
- 安装PCRE库
tar -zxvf pcre-8.39.tar.gz
cd pcre-8.39
./configure
make
make install
- 安装zlib库
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install
- 安装nginx
cd /usr/local/src
tar -zxvf nginx-1.1.10.tar.gz
cd nginx-1.1.10
./configure
make
make install
- 设置开机启动
# vi /etc/rc.local
添加一行:
/usr/local/nginx/sbin/nginx
# 设置执行权限
# chmod 755 rc.local
- 启动nginx 直接执行nginx会按照默认的配置文件进行服务器的启动,命令:
$ nginx
停止nginx服务命令,两种停止方式
$ nginx -s stop
或
$ nginx -s quit
- 查看nginx进程是否启动
$ ps -ef | grep nginx