zabbix学习之一:LNMP之nginx服务器编译安装

  • Nginx编译安装

    yum install -y wget gcc-c++ make pcre pcre-deve zlib zlib-devel openssl openssl-devel#安装依赖包
    cd/usr/local/src                                   #放nginx包的目录
    wget http://nginx.org/download/nginx-1.14.2.tar.gz #下载nginx包
    tar -zxvf nginx-1.14.2.tar.gz                      #解压包
    cd nginx-1.14.2                                    #进入nginx目录
    ./configure --prefix=/usr/local/nginx              #安装nginx到local目录下
    make && make install                               #编译安装
    vim /etc/profile                                   #编辑环境变量配置文件                         
    export PATH=$PATH:/usr/local/nginx/sbin/           #在环境变量文件末行加入这条配置
    source /etc/profile                                #重新加载环境变量配置文件
    nginx -V                                           #查看nginx版本
    nginx -t                                           #检查配置文件是否正常
    nginx                                              #启动nginx
    ps auxfww| grep nginx                              #查看nginx进程是否启动
    netstat -tulnp|grep nginx                          #查看nginx监控端口,默认是80端口
    systemctl stop firewalld.service                   #关闭防火墙
    systemctl disable firewalld.service                #禁止防火墙开机启动
    vim /etc/selinux/config                            #设置SELINUX=disabled 关闭selinux
    vim /usr/lib/systemd/system/nginx.service          #使用sytemclt管理nginx
    在nginx.service文件编写以下内容
       	[Unit]
       	Description=nginx
       	After=network.target
       	[Service]
       	Type=forking
       	ExecStart=/usr/local/nginx/sbin/nginx
       	[Install]
       	WantedBy=multi-user.target
    systemctl daemon-reload                            #重新加载systemctl daemon-reload
    systemctl start nginx                              #使用systemctl管理启动nginx
    systemctl enable nginx                             #设置开机自动启动nginx
    游览器打开服务器地址显示下面页面表示nginx开启正常
    ![游览器打开服务器地址显示下面页面表示nginx开启正常](https://img-blog.csdnimg.cn/20190511150141689.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3Jhb3NoYW95dW4=,size_16,color_FFFFFF,t_70)
    
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值