CentOS7,linux下nginx的安装过程——2.配置user,路径,openssl,make install,关闭防火墙,测试——源码

Centos7下Nginx源码编译安装
本文详细记录了在Centos7环境下,通过源码编译方式安装Nginx的过程,包括创建用户、配置模块、安装依赖、编译安装等步骤,并验证了安装成功。

源码中安装显示代码过多所以显示我操作的部分,IP用你们虚拟机的IP
1. [root@localhost nginx-1.6.3]# useradd www -s /sbin/nologin -M

  1. [root@localhost nginx-1.6.3]# ./configure –user=www –group=www –with-http_ssl_module –with-http_stub_status_module –prefix=/application/nginx-1.6.3

  2. [root@localhost nginx-1.6.3]# yum install openssl openssl-devel -y

  3. [root@localhost nginx-1.6.3]# echo $?
    0
    出现0前面均正确

  4. [root@localhost nginx-1.6.3]# make install

  5. 看到80口处于监听(listen )状态
    [root@localhost nginx-1.6.3]# netstat -lntup|grep 80
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 17331/nginx: master
    [root@localhost nginx-1.6.3]# lsof -i :80
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    nginx 17331 root 6u IPv4 40493 0t0 TCP *:http (LISTEN)
    nginx 17332 www 6u IPv4 40493 0t0 TCP *:http (LISTEN)

  6. Centos7下防火墙关闭
    [root@localhost nginx-1.6.3]# firewall-cmd –state
    running
    [root@localhost nginx-1.6.3]# systemctl stop firewalld.service
    [root@localhost nginx-1.6.3]# firewall-cmd –state
    not running
  7. [root@localhost nginx-1.6.3]# curl 10.10.10.2
    看结果中有welcome nginx

  8. [root@localhost nginx-1.6.3]# wget http://10.10.10.2
    –2018-08-01 01:15:36– http://10.10.10.2/
    正在连接 192.168.9.128:80… 已连接。
    已发出 HTTP 请求,正在等待回应… 200 OK
    长度:612 [text/html]
    正在保存至: “index.html.4”

结果中有200 OK
10. 打开浏览器输入http://10.10.10.2/
看结果中有welcome nginx 安装成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值