Nginx安装

一、服务器环境

1、centos7

二、下载软件

1、下载官网:http://nginx.org/en/download.html
2、版本号:nginx-1.11.10.tar.gz

三、开始安装

1、解压文件

tar -zxvf nginx-1.11.10.tar.gz -C /usr/local/

2、Nginx目录进行编译安装

cd  /usr/local/nginx-1.11.10/
./configure --prefix=/usr/local/nginx
make & make install

3、启动Nginx

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

常见错误

在进行./configure 命令的时候经常会因为缺少库文件而报错,如下:

错误一:缺少gc++库文件

解决方式:在线安装gcc gcc-++

yum -y install gcc  gcc-++ autoconf automake

错误二:缺少PCRE库

./configure: error: the HTTP rewrite module requires the PCRE library.

解决方式:安装pcre-devel解决问题

yum -y install pcre-devel

错误三:

错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
–without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
–with-http_ssl_module –with-openssl= options.

yum  -y install openssl openssl-devel

安装后继续执行configure命令,即可完成Nginx的安装

./configure --prefix=/usr/local/nginx

四、Nginx的启动、停止、重启

用命令:ps -ef|grep nginx 查看

root       7954   4087  0 22:36 pts/0    00:00:00 grep --color=auto nginx
root      89530      1  0 Mar06 ?        00:00:00 nginx: master process ./nginx -c /usr/local/nginx/conf/nginx.conf
nobody    89531  89530  0 Mar06 ?        00:00:01 nginx: worker process

1、启动

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

2、关闭

从容停止 : Kill -QUIT 89530 
快速停止 : kill -TERM 89530kill -INT 89530 
强制停止 : kill -9 89530
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值