nginx 安装

系统环境

[root@localhost ~]# cat /etc/redhat-release 
CentOS release 6.10 (Final)
[root@localhost ~]# uname -r
2.6.32-642.el6.x86_64

 

1.安装pcre源
[root@localhost ~]# yum -y install pcre pcre-devel

[root@localhost ~]# rpm -qa pcre pcre-devel
pcre-devel-7.8-7.el6.x86_64
pcre-7.8-7.el6.x86_64

2.检查nginx基础依赖包 pcre-devel,openssl-devel

[root@localhost ~]# rpm -qa pcre pcre-devel
pcre-devel-7.8-7.el6.x86_64
pcre-7.8-7.el6.x86_64
[root@localhost ~]# rpm -qa openssl openssl-devel
openssl-devel-1.0.1e-57.el6.x86_64
openssl-1.0.1e-57.el6.x86_64

缺少哪个包可以用yum安装

3.安装nginx

1)下载nginx-1.6.3

[root@localhost tools]# cd /tools/                                                                    #进入程序专用目录
[root@localhost tools]# wget -q http://nginx.org/download/nginx-1.6.3.tar.gz #下载1.6.3版本,如果链接不存在可能是版本已经更新,可以去官方地址nginx.org下载
[root@localhost tools]# ll
total 788
-rw-r--r--. 1 root root 805253 Apr  7  2015 nginx-1.6.3.tar.gz

2)创建nginx用户

[root@localhost tools]# useradd nginx -s /sbin/nologin -M

3)解压并编译安装

[root@localhost tools]# tar -zxf nginx-1.6.3.tar.gz 
[root@localhost tools]# cd nginx-1.6.3

[root@web02 nginx-1.6.3]# ./configure \
> --prefix=/application/nginx-1.6.3 \
> --user=nginx \
> --group=nginx \
> --with-http_stub_status_module \ ##激活状态信息
> --with-http_ssl_module  ##激活ssl

 

[root@localhost nginx-1.6.3]# make &&make install

4)创建软连接

[root@localhost nginx-1.6.3]# ln -s /application/nginx-1.6.3/ /application/nginx

4.启动并检查安装结果

[root@localhost nginx-1.6.3]# cd 
[root@localhost ~]# /application/nginx/sbin/nginx -t    #检查配置文件
nginx: the configuration file /application/nginx-1.6.3/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test is successful
[root@localhost ~]# /application/nginx/sbin/nginx      #启动nginx
[root@localhost ~]# lsof -i:80                                     #检查nginx默认端口80是否成功开启
COMMAND   PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx   67082  root    6u  IPv4 210442      0t0  TCP *:http (LISTEN)
nginx   67083 nginx    6u  IPv4 210442      0t0  TCP *:http (LISTEN)

[root@localhost ~]# wget 127.0.0.1 

[root@localhost ~]# curl 127.0.0.1                             #用linux命令检查是否启动成功

5.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值